我正在尝试为wp8生成一个pthread lib,但是lib文件似乎不起作用。我以函数thread_self()
为例进行解释。
首先,我使用该命令检查.lib:dumpbin /symbols pthread_lib.lib
当我使用'pthread_self'grep输出时,输出包含如下信息:
01D 00000000 UNDEF notype External | __imp__pthread_self
023 00000000 UNDEF notype External | __imp__pthread_self
01A 00000000 UNDEF notype External | __imp__pthread_self
011 00000000 UNDEF notype External | __imp__pthread_self
011 00000000 UNDEF notype External | __imp__pthread_self
011 00000000 UNDEF notype External | __imp__pthread_self
011 00000000 UNDEF notype External | __imp__pthread_self
011 00000000 SECT4 notype () External | _pthread_self
012 00000000 UNDEF notype External | __imp__pthread_self
012 00000000 UNDEF notype External | __imp__pthread_self
018 00000000 UNDEF notype External | __imp__pthread_self
012 00000000 UNDEF notype External | __imp__pthread_self
014 00000000 UNDEF notype External | __imp__pthread_self
011 00000000 UNDEF notype External | __imp__pthread_self
024 00000000 UNDEF notype External | __imp__pthread_self
40D 00000000 SECTAE notype () External | _pthread_self
059 00000000 UNDEF notype External | __imp__pthread_self
08B 00000000 UNDEF notype External | __imp__pthread_self
054 00000000 SECT10 notype () External | _pthread_self
012 00000000 UNDEF notype External | __imp__pthread_self
036 00000000 UNDEF notype External | __imp__pthread_self
这意味着lib中包含pthread_self
,不是吗?
其次,我创建了一个控制台应用程序项目,更改了这样的设置:
将“c / c ++ - >附加包含目录”设置为.\headers;%(AdditionalIncludeDirectories)
(标题目录是放置pthread.h的地方)
将“链接器 - >其他库目录”设置为.\libs;%(AdditionalLibraryDirectories)
(libs目录是放置pthread_lib.lib的地方)
使用pthread_lib.lib附加“链接器 - >输入 - >附加依赖项”;
ConsoleApplication1.cpp是:
#include "stdafx.h"
#include <iostream>
#include "pthread.h"
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
cout << "test" << endl;
pthread_self();
system("pause");
return 0;
}
然后当我跑它时,得到了错误:
Error 1 error LNK2019: unresolved external symbol __imp__pthread_self referenced in function _wmain ...\ConsoleApplication1\ConsoleApplication1.obj
如何检查和解决?