2
votes

I download pthread-w32-2-9-1-release.zip, unzip it and use Prebuild/include lib and dll with VisualStudio2013.

I set up a VC++ empty project "helloc" with main.c, then write a simple example with pthread_create pthread_join functions.

This is my configure:

Properties->C/C++->General->Additional Include Directories, add "F:\pthread_win32\include"

Properties->Linker->General->Additional Library Directories, add "F:\pthread_win32\lib\x86"

Properties->Linker->Input->Additional Dependencies, add "pthreadVC2.lib"

And it's successfully build, but when I click "Local Windows Debugger", the console break with "helloc.exe error because cannot find pthreadVC2.dll".

Then I copied pthreadVC2.dll to helloc/Debug/, same directory with helloc.exe, finally it's working.

But I don't know why the pthreadVC2.lib and pthreadVC2.dll are both required by helloc.exe. Is it a must that both lib and dll being used in VisualStudio ?

If only one of them (pthreadVC2.lib pthreadVC2.dll) is enough to support helloc.exe, how can I specify which one (dll or lib) I want to use in VisualStudio with helloc.exe ?

And I don't want to put all pthread libs and dlls into "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC", I want to know how to configure manually.

1

1 Answers

1
votes

AFAICT, the pre-built library is just an import library for the DLL. (Allowing you to link against the DLL, hence required) If you want to link statically, you'll have to rebuild the library yourself. See the README file for more information.