delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/03/24/09:31:45

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
MIME-Version: 1.0
Subject: RE: Cygwin problem make Linux c++ app in windows
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" <dporges AT chipwrights DOT com>
To: <cygwin AT cygwin DOT com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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 <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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019