difficulty with c++ boost::thread (1.53.0) on Cygwin 1.7.20(0.266/5/3)

marco atzeri marco.atzeri@gmail.com
Sun Jun 30 08:19:00 GMT 2013


Il 6/30/2013 12:00 AM, Lewis Sternberg ha scritto:
>
> first off, I'm getting "cygcheck: Wrong architecture. Only ix86
> executables supported." when running cygcheck.
> That said, ...
>
> The attached multithread.cpp ought to run as far as I can tell from
> Cygwin, Boost, & the web.
> (There is a posting from 2010 regarding problems with building
> boost::thread on Cygwin, but I'm able to build, and anyway, the Cygwin
> package already includes an up-to-date version of boost::thread.
>
> If I try to compile the attached code thus:
>       $  g++ -D THREADED multithread.cpp

no libraries link instruction, so of course "undefined reference"

> I get:
>       /tmp/ccpBRr49.o:multithread.cpp:(.text+0x259): undefined reference to
> `boost::system::generic_category()'
>       /tmp/ccpBRr49.o:multithread.cpp:(.text+0x263): undefined reference to
> `boost::system::generic_category()'
>       /tmp/ccpBRr49.o:multithread.cpp:(.text+0x26d): undefined reference to
> `boost::system::system_category()'
>       /usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld:
> /tmp/ccpBRr49.o: bad reloc address 0xb in
> section`.text$_ZN5boost6system14error_categoryD1Ev[boost::system::error_category::~error_category()]'
>       collect2: ld returned 1 exit status
>
> If I add the option to load libbost_system (as suggested by some threads
> on the web):
>       $  g++ -D THREADED -llibboost_system multithread.cpp

on MS the linking order is important...

$ g++ -D THREADED  multithread.cpp -l boost_system-mt -l boost_thread-mt

$ ./a.exe
0, 0, 0, 0
0, 3.93049e-06, 0, 0

>
> thank you for your attention and (hopefully) help,
> Lewis
>

Regards
Marco


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



More information about the Cygwin mailing list