How to set pthread_win32 (Windows pthread / posix thread library) for Visual Studio 2005?

Just to be clear - I searched the depths of the Internet and returned information on how to do this

I am looking for help to create pthread_Win32 for working with Visual Studio 2005. I program in C and I have many multi-threaded write jobs using pthread.h. However, since pthread is native to unix, I have to write all my code, ftp it, and then ssh to my remote unix system for my class to run it. This makes development take much longer and is incredibly inefficient. I would like (more than anything) to get this work on my win32 machine so that I can develop in a visual studio, as I have been doing for quite some time.

I installed the pthread.lib file and the pthread.h file in the appropriate lib / header directories where all the other files are located. The DLL, on the other hand (the actual library), I placed in c: \ windows \ system32. I tried to add the DLL to the dependency (right-click project β†’ links β†’ Add new link), but as others claim, all I get is an empty dialog box without the ability to add any DLL files or anything else. It seems to recognize the header file, but I get these errors when compiling:

1> Samples ...

1> main.obj: error LNK2019: unresolved external symbol _imp_pthread_join specified in _main function

1> main.obj: error LNK2019: unresolved external symbol _imp_pthread_create specified in the _main function

1 > main.obj: LNK2019: _imp_pthread_exit, _fcount

, DLL, , , . , , . lib/header , , . - , , pthreadVC2.dll - ( ).

?

0
3

. , __ imp __ , pthread.h . PTW32_STATIC_LIB , pthread.h, .

#define PTW32_STATIC_LIB
#include <pthread.h>

, Visual Studio _ [FuncName] [FuncName]

, -, -, (.lib) (.dll).

, :

__declspec (dllimport) int myFunc(int myArgs) ;

, :

__declspec (dllexport) int myFunc(int myArgs) ;

, , :

int myFunc(int myArgs) ;

< > [EDIT]

MS. , _ [FuncName] :

int __cdecl myFunc(int MyArgs) ;
+3

pthreadVC.lib ( lib ) :

Linker/Input/Additional Dependencies

lib , , .

+1

pthreadVC2.lib . addtional lib, pthreadVCE2.lib pthreadVSE2.lib.

, .

0

All Articles