This is the mail archive of the
cygwin
mailing list for the Cygwin project.
RE: Cygwin problem make Linux c++ app in windows
- From: "Don Porges" <dporges at chipwrights dot com>
- To: <cygwin at cygwin dot com>
- Date: Wed, 24 Mar 2010 10:31:29 -0400
- Subject: RE: Cygwin problem make Linux c++ app in windows
- References: <28010814.post@talk.nabble.com>
-----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.
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