This is the mail archive of the
pthreads-win32@sourceware.org
mailing list for the pthreas-win32 project.
Error linking static library (x64) in VS2008
- From: S R <sriram_ott at yahoo dot com>
- To: "pthreads-win32 at sourceware dot org" <pthreads-win32 at sourceware dot org>
- Date: Thu, 18 Jul 2013 17:30:24 -0700 (PDT)
- Subject: Error linking static library (x64) in VS2008
- References: <1374179109 dot 59111 dot YahooMailNeo at web162205 dot mail dot bf1 dot yahoo dot com>
- Reply-to: S R <sriram_ott at yahoo dot com>
I am having trouble linking my application statically on a x64 platform...(there is no problem linking the application
with the dll version).. Additional details on the errors are attached below.
Any help is much appreciated.
Thanks
Sriram
Compiler: VS 2008 9.0
System: Windows XP SP2 on x64
Errors:
xxx.obj : error LNK2019: unresolved external symbol pthread_mutex_init referenced in function ....
xxx.obj : error LNK2019: unresolved external symbol pthread_mutex_destroy referenced in function ....
xxx.obj : error LNK2019: unresolved external symbol pthread_mutex_lock referenced in function ....
xxx.obj : error LNK2019: unresolved external symbol pthread_mutex_unlock referenced in function ....
Steps I followed:
1. I compiled a static version of the pthreads_win32 lib with no errors
nmake clean VC-static
2. Added PTW32_STATIC_LIB to preprocessor flags for application
Added path to static lib in Linker->General->Additional Library Directories
Added pthreadVC2.lib in Linker->Input->Additional Dependencies
3. Looked at symbols in pthreadVC2.lib searching (for example) for pthread_mutex_init
2BFA _pthread_mutex_init
2 _pthread_mutex_init
COMDAT; sym= _pthread_mutex_init
00000000 DIR32NB 00000000 F4 _pthread_mutex_init
000000A2 REL32
00000000 F4 _pthread_mutex_init
0000008C REL32 00000000 F4 _pthread_mutex_init
000000A3 REL32 00000000 F4 _pthread_mutex_init
00000068 REL32 00000000 F4 _pthread_mutex_init
000000B0 REL32
00000000 F4 _pthread_mutex_init
000000B6 REL32 00000000 F4 _pthread_mutex_init
0F4 00000000 SECT51 notype () External | _pthread_mutex_init
--- For comparison, in the dynamically built pthreadVC32.lib, the symbols are slightly different:
5578 __imp_pthread_mutex_init
5578 pthread_mutex_init
1B __imp_pthread_mutex_init
1B pthread_mutex_init
Symbol name : pthread_mutex_init
Name : pthread_mutex_init
pthread_mutex_init
--- In file xxx.obj, the references appear as follows:
61934 _pthread_mutex_init
1 _pthread_mutex_init
COMDAT; sym= _pthread_mutex_init
00000000 DIR32NB 00000000 F4 _pthread_mutex_init
000000A2 REL32 00000000 F4 _pthread_mutex_init
0000008C REL32 00000000 F4 _pthread_mutex_init
000000A3 REL32 00000000 F4 _pthread_mutex_init
00000068 REL32 00000000 F4 _pthread_mutex_init
000000B0 REL32 00000000 F4 _pthread_mutex_init
000000B6 REL32 00000000 F4 _pthread_mutex_init
0F4 00000000 SECT51 notype () External | _pthread_mutex_init
0000000C REL32 00000000 4AC pthread_mutex_init
0000000E REL32 00000000 4AC pthread_mutex_init
4AC 00000000 UNDEF notype () External | pthread_mutex_init