public inbox for pthreads-win32@sourceware.org
 help / color / mirror / Atom feed
From: "Kailas Narendran" <kailas@gmail.com>
To: pthreads-win32@sourceware.org
Subject: Build Issues with pthreads
Date: Thu, 04 Dec 2008 19:10:00 -0000	[thread overview]
Message-ID: <1d9c131c0812041110y462a61a4kc71fa58d3b9e6f42@mail.gmail.com> (raw)

Hi, I'm having problems linking pthreads into my application.
I'm developing an API for some hardware I've made.  If I compile
everything and link the pthreads library, everything works:

(this works)

g++ -D __WIN32__ -Ic:/progra~1/kvaser/canlib/inc -I. -I../Common
-I../XitomeMCBAPI ../Common/DynamicSmoothTrajectory.cpp
../XitomeMCBAPI/FunctionGeneratorNode.cpp
../XitomeMCBAPI/XitomeMCBNode.cpp ../XitomeMCBAPI/XitomeMCBNet.cpp
../Common/CommandList.cpp ../Common/CommandNode.cpp
../Common/CANCommon.cpp ../Common/Delay.cpp ../Common/Kbhit.cpp
../Common/ParseCMDLine.cpp ../Common/UtilityTimer.cpp XiHome.cpp
../Common/lib/libpthreadGC2.a ../XitomeMCBAPI/libxitomemcb.a
-lcanlib32 -lm  -Lc:/progra~1/kvaser/canlib/lib/ms -L.
-L..\XitomeMCBAPI -o XiHome

this is a bit slow and doesn't lend itself to really making an easy to
use API, so i'm trying to compile everything to a library that can be
linked into projects using my hardware (and software API).

to do this, i compile my sources to objects and link them into a
library [1].  When i do so, i get the error:

g++ -o XiHome XiHome.o ../Common/lib/libpthreadGC2.a ../XitomeMCBAPI/libxitomemc
b.a -lcanlib32 -lm -Lc:/progra~1/kvaser/canlib/lib/ms -L.
../XitomeMCBAPI/libxitomemcb.a(XitomeMCBNet.o):XitomeMCBNet.cpp:(.text+0xae3): u
ndefined reference to `pthread_exit'
collect2: ld returned 1 exit status
make[1]: *** [XiHome] Error 1

This works fine under linux.

I've looked around the mailing list archive and saw that others were
having similar issues with undefined references and I've tried
defining both PTW32_EXTERN as well as PTW32_STATIC_LIB (if i use
PTW32_EXTERN the error is _imp__pthread_exit)

anyone know what i'm doing wrong?

thanks!

-kailas

1 -

make -C Common all
make[1]: Entering directory `C:/xitome/MCB/Software/Common'
g++ -D __WIN32__ -D PTW32_STATIC_LIB -Ic:/progra~1/kvaser/canlib/inc -I. -I../Co
mmon -I../XitomeMCBAPI -c -o DynamicSmoothTrajectory.o DynamicSmoothTrajectory.c
pp
g++ -D __WIN32__ -D PTW32_STATIC_LIB -Ic:/progra~1/kvaser/canlib/inc -I. -I../Co
mmon -I../XitomeMCBAPI -c -o CommandList.o CommandList.cpp
g++ -D __WIN32__ -D PTW32_STATIC_LIB -Ic:/progra~1/kvaser/canlib/inc -I. -I../Co
mmon -I../XitomeMCBAPI -c -o CommandNode.o CommandNode.cpp
g++ -D __WIN32__ -D PTW32_STATIC_LIB -Ic:/progra~1/kvaser/canlib/inc -I. -I../Co
mmon -I../XitomeMCBAPI -c -o CANCommon.o CANCommon.cpp
g++ -D __WIN32__ -D PTW32_STATIC_LIB -Ic:/progra~1/kvaser/canlib/inc -I. -I../Co
mmon -I../XitomeMCBAPI -c -o Delay.o Delay.cpp
g++ -D __WIN32__ -D PTW32_STATIC_LIB -Ic:/progra~1/kvaser/canlib/inc -I. -I../Co
mmon -I../XitomeMCBAPI -c -o Kbhit.o Kbhit.cpp
g++ -D __WIN32__ -D PTW32_STATIC_LIB -Ic:/progra~1/kvaser/canlib/inc -I. -I../Co
mmon -I../XitomeMCBAPI -c -o ParseCMDLine.o ParseCMDLine.cpp
g++ -D __WIN32__ -D PTW32_STATIC_LIB -Ic:/progra~1/kvaser/canlib/inc -I. -I../Co
mmon -I../XitomeMCBAPI -c -o UtilityTimer.o UtilityTimer.cpp
make[1]: Leaving directory `C:/xitome/MCB/Software/Common'
make -C XitomeMCBAPI all
make[1]: Entering directory `C:/xitome/MCB/Software/XitomeMCBAPI'
g++ -D __WIN32__ -D PTW32_STATIC_LIB -Ic:/progra~1/kvaser/canlib/inc -I. -I../Co
mmon -I../XitomeMCBAPI -c -o FunctionGeneratorNode.o FunctionGeneratorNode.cpp
g++ -D __WIN32__ -D PTW32_STATIC_LIB -Ic:/progra~1/kvaser/canlib/inc -I. -I../Co
mmon -I../XitomeMCBAPI -c -o XitomeMCBNode.o XitomeMCBNode.cpp
g++ -D __WIN32__ -D PTW32_STATIC_LIB -Ic:/progra~1/kvaser/canlib/inc -I. -I../Co
mmon -I../XitomeMCBAPI -c -o XitomeMCBNet.o XitomeMCBNet.cpp
ar -cvq libxitomemcb.a FunctionGeneratorNode.o XitomeMCBNode.o XitomeMCBNet.o ..
/Common/DynamicSmoothTrajectory.o ../Common/CommandList.o ../Common/CommandNode.
o ../Common/CANCommon.o ../Common/Delay.o ../Common/Kbhit.o ../Common/ParseCMDLi
ne.o ../Common/UtilityTimer.o
a - FunctionGeneratorNode.o
a - XitomeMCBNode.o
a - XitomeMCBNet.o
a - ../Common/DynamicSmoothTrajectory.o
a - ../Common/CommandList.o
a - ../Common/CommandNode.o
a - ../Common/CANCommon.o
a - ../Common/Delay.o
a - ../Common/Kbhit.o
a - ../Common/ParseCMDLine.o
a - ../Common/UtilityTimer.o
make[1]: Leaving directory `C:/xitome/MCB/Software/XitomeMCBAPI'
make -C Utilities all
make[1]: Entering directory `C:/xitome/MCB/Software/Utilities'
g++ -o XiHome XiHome.o ../Common/lib/libpthreadGC2.a ../XitomeMCBAPI/libxitomemc
b.a -lcanlib32 -lm -Lc:/progra~1/kvaser/canlib/lib/ms -L.
make[1]: Leaving directory `C:/xitome/MCB/Software/Utilities'

             reply	other threads:[~2008-12-04 19:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-04 19:10 Kailas Narendran [this message]
     [not found] ` <575361.54101.qm@web51101.mail.re2.yahoo.com>
     [not found]   ` <1d9c131c0812041211t463f2490r846b744f60618894@mail.gmail.com>
2008-12-04 20:18     ` Fwd: " Kailas Narendran

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1d9c131c0812041110y462a61a4kc71fa58d3b9e6f42@mail.gmail.com \
    --to=kailas@gmail.com \
    --cc=pthreads-win32@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).