X-Recipient: archive-cygwin@delorie.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.post@talk.nabble.com>
From: "Don Porges" <dporges@chipwrights.com>
To: <cygwin@cygwin.com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

=20

-----Original Message-----
From: cygwin-owner@cygwin.com [mailto:cygwin-owner@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.=20

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=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

