This is the mail archive of the pthreads-win32@sourceware.org mailing list for the pthreas-win32 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Error linking static library (x64) in VS2008



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]