0

I am trying to run the producer-consumer code in visual studio 2010 . I copied code from below location

http://www.dailyfreecode.com/code/producer-consumer-problem-thread-1105.aspx#

My os is windows (64bit) I have downloaded the required pthread dll,lib and include folder from the below location for WINDOWS ..

 ftp://sourceware.org/pub/pthreads-win32/

I am able to add the include and lib path through project properties window of Visual studio 2010 . But I did not find the option to add extra dll through the property window of c++ project .. and I am getting the below error for my code base :

error LNK2019: unresolved external symbol __imp__pthread_join referenced in function _main
error LNK2019: unresolved external symbol __imp__pthread_create referenced in function _main
error LNK2019: unresolved external symbol __imp__pthread_cond_signal referenced in function "void * __cdecl Producer(void)" (?Producer@@YAPAXXZ)
error LNK2019: unresolved external symbol __imp__pthread_mutex_unlock referenced in function "void * __cdecl Producer(void)" (?Producer@@YAPAXXZ)
error LNK2019: unresolved external symbol __imp__pthread_cond_wait referenced in function "void * __cdecl Producer(void)" (?Producer@@YAPAXXZ)
error LNK2019: unresolved external symbol __imp__pthread_mutex_lock referenced in function "void * __cdecl Producer(void)" (?Producer@@YAPAXXZ)

How to solve this problem ...

Ashwin
  • 411
  • 1
  • 10
  • 28
  • You must add the pthread*.lib file(s) to your project. – Jabberwocky Feb 24 '14 at 15:33
  • I have added this lib path through project->properties->VC++ Directories ->Library Directories ........But still same errors persisted ..no change in error count ... I copied the lib from here : ftp://sourceware.org/pub/pthreads-win32/ – Ashwin Feb 24 '14 at 15:37
  • +added the lib through property option->linker->Additional library directoies ....still same issue – Ashwin Feb 24 '14 at 15:44
  • You must add the *library* (.lib) file(s) to the project. Adding the "Additional library directoies" is not enough. – Jabberwocky Feb 24 '14 at 15:52
  • As I am thinking ,finally adding library or adding additional library in same project is one and same ... – Ashwin Feb 24 '14 at 16:17
  • Sorrry I didn't understand you last comment. – Jabberwocky Feb 24 '14 at 16:20
  • As you have mentioned in your comment to add library files to project is nothing but same as like Additional library directories option in Visual studio ...Both intention is same to include library to the vs project . – Ashwin Feb 24 '14 at 16:24
  • Not it isn't. You must add the .lib file(s) excplicitly to your project. Go to the property option->Linker->Additional Dependencies and add the *.lib file(s) there. – Jabberwocky Feb 24 '14 at 16:35
  • same errors with your suggestions also !!! :( – Ashwin Feb 24 '14 at 16:50
  • I usually put third-party DLLs in a separate 'ExternalLibs' project subdirectory, then add references to those DLLs in the other subdirectories/subprojects that need them. VS will then do all the necessary copying of the files during the building and linking. – David R Tribble Feb 24 '14 at 17:00

0 Answers0