X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Subject: RE: Cygwin problem make Linux c++ app in windows Content-Transfer-Encoding: quoted-printable Date: Wed, 24 Mar 2010 10:31:29 -0400 Message-ID: <2175F853309F0C4F924EB2F995C38EED0161AB2C@chipmail.chipwrights.com> In-Reply-To: <28010814.post@talk.nabble.com> References: <28010814 DOT post AT talk DOT nabble DOT com> From: "Don Porges" To: X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com =20 -----Original Message----- From: cygwin-owner AT cygwin DOT com [mailto:cygwin-owner AT cygwin DOT com] On Behalf Of crmpteltd Sent: Wednesday, March 24, 2010 1:28 AM To: cygwin AT cygwin DOT 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.=20 from the first few error log, it seems there is a problem recognizing pthread.h the Linux lib used are: #include #include #include #include #include The make command was g++ -c -Wall main.cpp http_client.cpp string.cpp -lpthread main.o=20 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