I have compiled pthreads-win32 as a static library using VS 2008 with the following preprocessor definitions: _DEBUG _WIN32_WCE=0x600 UNDER_CE WINCE DEBUG _LIB ARM _ARM_ _UNICODE UNICODE HAVE_CONFIG_H NEED_PROCESS_AFFINITY_MASK NEED_ERRNO __PTW32_RC_MSC __PTW32_ARCHARM __PTW32_STATIC_LIB However, when I try to link it with my project I get the following linker errors: error LNK2001: unresolved external symbol __imp_pthread_mutex_unlock error LNK2001: unresolved external symbol __imp_pthread_mutex_lock error LNK2001: unresolved external symbol __imp_pthread_self error LNK2001: unresolved external symbol __imp_pthread_cond_signal error LNK2001: unresolved external symbol __imp_pthread_join error LNK2001: unresolved external symbol __imp_pthread_create error LNK2001: unresolved external symbol __imp_pthread_equal error LNK2019: unresolved external symbol __imp_pthread_cond_timedwait error LNK2019: unresolved external symbol __imp_pthread_cond_broadcast When I use `dumpbin /symbols` on the static library I see the following symbols: 4BE 00005CC0 SECT8 notype () External | pthread_mutex_unlock 44D 000050B4 SECT8 notype () External | pthread_mutex_lock 399 00004428 SECT8 notype () External | pthread_self 2E6 0000359C SECT8 notype () External | pthread_cond_signal 83D 0000A110 SECT8 notype () External | pthread_join 332 00003D50 SECT8 notype () External | pthread_create 377 0000423C SECT8 notype () External | pthread_equal 32B 00003D00 SECT8 notype () External | pthread_cond_timedwait 302 000038C0 SECT8 notype () External | pthread_cond_broadcast Why is the linker trying to resolve the functions with the prefix `__imp_`? What do I need to do to resolve the symbols?
I should also state that I do have the full name and path of my pthreads-win32 static library as an additional linker dependency within my project. https://sourceware.org/ml/pthreads-win32/2013/msg00015.html
On 08/11/2018 21:53, Josh Henrie wrote:
> Why is the linker trying to resolve the functions with the prefix `__imp_`?
> What do I need to do to resolve the symbols?
>
The prefix '__imp_' signifies that your main project (i.e. not the
pthreads_win32 project) is expecting to import those symbols from a DLL
(but it found a static link lib, rather than the DLL link lib that it
was expecting). Basically, there's a mismatch between your main project
and pthreads_win32. Most likely, your main project also needs to
#define PTW32_STATIC_LIB (so that BOTH projects expect a static lib).
Hope that helps,
John