c++ - error LNK2019: unresolved external symbol __imp__pthread_self referenced in function -
i'm trying generate pthread lib wp8, lib file seems not work. take function thread_self()
example explain it.
first, use command check .lib: dumpbin /symbols pthread_lib.lib
when grep output 'pthread_self', output contains information this:
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
it means pthread_self
included in lib, doesn't it?
second, created console application project, change settings this:
set "c/c++ -> additional include directories"
.\headers;%(additionalincludedirectories)
(headers dir pthread.h placed in)
set "linker -> additional library directories"
.\libs;%(additionallibrarydirectories)
(libs dir pthread_lib.lib placed in)
append "linker -> input -> additional dependencies" pthread_lib.lib;
and consoleapplication1.cpp is:
#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; }
then when ran it, got error:
error 1 error lnk2019: unresolved external symbol __imp__pthread_self referenced in function _wmain ...\consoleapplication1\consoleapplication1.obj
how check , resolve it?
Comments
Post a Comment