求助------编译错误-“_beginthreadex”:“未声明的标识符”
下载了一个源代码,能正常编译。但自己仿照自己写一个时,却不能正常编译。
源代码中首先是作如下定义:
////test.h
........(略)
#include<process.h>
........(略)
#define beginpeerthread(pfnstartaddr,pvparam,pdwthreadid)\
((handle)(_beginthreadex((void*)null,\
0,\
(pthread_start)(pfnstartaddr),\
(void*)(pvparam),\
0,\
(unsigned*)(pdwthreadid)\
)\
)\
)
#define endpeerthread(retval) _endthreadex((unsigned)retval)
//////test.cpp
........(略)
if((hnewthread=beginpeerthread(serverthread,&connectsocketinfo
,&dwnewthreadid))==null)///////就是这一句发生了错误,即下面说的117行
........(略)
但是编译是却发生错误:d:\maproject\test\test.cpp(117): error c2065: “_beginthreadex” : 未声明的标识符.
可是我已经加了#include<process.h>这一句了呀。是不是beginpeerthread()的定义有问题还是其他什么地方出了问题?
推荐阅读
是不是建立了一个不支持多线程的项目,#include"process.h"前面#define _mt试一下
按alt+f7,在c/c++选项下的 code generation里选debug multithreaded 看看.
.

讨论区