Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C 我能';t在Windows平台中使用pthread_C_Pthreads_Pthreads Win32 - Fatal编程技术网

C 我能';t在Windows平台中使用pthread

C 我能';t在Windows平台中使用pthread,c,pthreads,pthreads-win32,C,Pthreads,Pthreads Win32,我的环境是Windows8.1(64位),使用Visual Studio 2010 我确实将所有*.dll文件都放在了system32、SYSWOW64中(因为我使用的是64位的win8) 以及使用VC 2010的x64系统的*.lib文件所在的链接位置 当然,我添加了其他文件夹lib forders,包括文件夹。。等等 但当我尝试编译“pthread used”项目时,出现了致命错误 -来源 #include<pthread.h> #include<stdio.h> i

我的环境是Windows8.1(64位),使用Visual Studio 2010

我确实将所有*.dll文件都放在了system32、SYSWOW64中(因为我使用的是64位的win8)

以及使用VC 2010的x64系统的*.lib文件所在的链接位置

当然,我添加了其他文件夹lib forders,包括文件夹。。等等

但当我尝试编译“pthread used”项目时,出现了致命错误

-来源

#include<pthread.h>
#include<stdio.h>
int doit_id,trd_id;
pthread_t trd;
void *doit(void *data){
    doit_id = (int)data;
    return 0;
}
int main(){
    trd_id=pthread_create(&trd,NULL,doit,0);
    return (0);
}

请帮帮我您的
main()
正在查找名称
\uuu imp\uu pthread\u create
表明您正在为32位目标构建项目

64位Win32 pthread库中有一个导入符号,用于
pthread\u create()
,名称为:

__imp_pthread_create
32位Win32 pthread库具有:

__imp__pthread_create
请注意32位库中的额外下划线-它与您的
main()
所寻找的名称约定相匹配,因此它表示您正在为32位目标构建。额外的下划线是x86构建如何在Win32 pthread库使用的cdecl调用约定中处理名称的一部分。x64不使用cdecl调用约定(x64只有一个调用约定),并且在x64构建中,符号前面没有下划线


我认为您需要下载或构建32位pthread库,或者更改项目配置以构建64位目标。

是否尝试在返回类型为void的方法中返回值?您添加了额外的lib forder。您是否已将必需的.lib文件添加到链接器依赖项列表中?Okuma.Scott//它什么都没有。在这种情况下,返回值是否存在并不重要。///Alex Faber//当然,我链接了VC project configure.Okuma.Scott//上依赖项列表中的*.lib文件。此外,当我在那里设置返回值时,我可以在pthread_join中获得该值。问题解决了!谢谢你帮助我。非常非常非常非常感谢你。
__imp__pthread_create