读书人

dev cpp 多线程解决方案

发布时间: 2012-02-09 18:22:27 作者: rapoo

dev cpp 多线程
很奇怪的错误,真是摸不着头脑
// start server thread
unsigned threadID;
HANDLE hServer = _beginthreadex(
NULL, // default security attributes
0, // defautl stack size: 1M
ServerThread, // thread function addr
NULL, // thread function parameter addr
0, // create flags
&threadID); // thread identifier

编译提示最后一个参数类型不对: invalid conversion from `long unsigned int ' to `void* '
可是_beginthreadex最后一个参数就是unsigned 类型啊?

Dev-C++ version 4.9.9.2



[解决办法]
long unsigned threadID;
这样看看

[解决办法]
(void *)&threadID
[解决办法]
&threadID
==》
(void *)&threadID 强制类型转化一下

have a try ~

读书人网 >C++

热点推荐