-----Original Message----- From: cygwin-ow...@cygwin.com [mailto:cygwin-ow...@cygwin.com] On Behalf Of crmpteltd Sent: Wednesday, March 24, 2010 1:28 AM To: cygwin@cygwin.com Subject: Cygwin problem make Linux c++ app in windows
Hi all, I am a new user of Cygwin, seeking advice on a make problem in Cygwin. I downloaded a Linux C++ app source file and was looking forward to compiling in windows using the makefile. However, I got a long list of error below. I checked with the author, and the app has no problem in Linux. from the first few error log, it seems there is a problem recognizing pthread.h the Linux lib used are: #include <sys/socket.h> #include <arpa/inet.h> #include <netdb.h> #include <pthread.h> #include <sys/stat.h> The make command was g++ -c -Wall main.cpp http_client.cpp string.cpp -lpthread main.o g++ http_client.o string.o -o main Is there some settings I need to change to compile Linux apps in windows? main.o: In function `main': main.cpp:(.text+0x278): undefined reference to `pthread_create' main.cpp:(.text+0x2b0): undefined reference to `_ZSt4cout' main.cpp:(.text+0x2b5): undefined reference to `_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKSbIS4_S5_ T1_E' main.cpp:(.text+0x2c5): undefined reference to `_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc' main.cpp:(.text+0x2d1): undefined reference to `_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKSbIS4_S5_ T1_E' [more snipped] ------------------------------- Those are link errors. You've added the -lpthread, which is a library argument, to the compiler invocation, where it will have no effect. You need to add it to the second line, which is the link. Presumably the author's gcc/linux installation includes the contents of the pthread library in its default library list, but cygwin's does not. -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple