
My code (simplyfication of this: http://www.boost.org/doc/libs/1_47_0/doc/html/boost_asio/tutorial/tuttimer1/...): #include <iostream> #include </usr/local/include/boost/asio.hpp> // Boost version 1.47.0 int main() { return 0; } Compilation command: g++ -Wall -o timer1 timer1.cpp Error: /tmp/ccGUgnoD.o: In function `__static_initialization_and_destruction_0(int, int)': timer1.cpp:(.text+0x52): undefined reference to `boost::system::generic_category()' timer1.cpp:(.text+0x5e): undefined reference to `boost::system::generic_category()' timer1.cpp:(.text+0x6a): undefined reference to `boost::system::system_category()' /tmp/ccGUgnoD.o: In function `boost::asio::error::get_system_category()': timer1.cpp:(.text._ZN5boost4asio5error19get_system_categoryEv[boost::asio::error::get_system_category()]+0x5): undefined reference to `boost::system::system_category()' /tmp/ccGUgnoD.o: In function `boost::asio::detail::posix_tss_ptr_create(unsigned int&)': timer1.cpp:(.text._ZN5boost4asio6detail20posix_tss_ptr_createERj[boost::asio::detail::posix_tss_ptr_create(unsigned int&)]+0x19): undefined reference to `pthread_key_create' /tmp/ccGUgnoD.o: In function `boost::asio::detail::posix_tss_ptr<boost::asio::detail::call_stack<boost::asio::detail::task_io_service>::context>::~posix_tss_ptr()': timer1.cpp:(.text._ZN5boost4asio6detail13posix_tss_ptrINS1_10call_stackINS1_15task_io_serviceEE7contextEED2Ev[_ZN5boost4asio6detail13posix_tss_ptrINS1_10call_stackINS1_15task_io_serviceEE7contextEED5Ev]+0x15): undefined reference to `pthread_key_delete' /tmp/ccGUgnoD.o: In function `boost::asio::detail::posix_tss_ptr<boost::asio::detail::call_stack<boost::asio::detail::strand_service::strand_impl>::context>::~posix_tss_ptr()': timer1.cpp:(.text._ZN5boost4asio6detail13posix_tss_ptrINS1_10call_stackINS1_14strand_service11strand_implEE7contextEED2Ev[_ZN5boost4asio6detail13posix_tss_ptrINS1_10call_stackINS1_14strand_service11strand_implEE7contextEED5Ev]+0x15): undefined reference to `pthread_key_delete' collect2: ld returned 1 exit status make: *** [all] Error 1 Any ideas? Thanks in advance. -- Alessandro Candini MEEO S.r.l. Via Saragat 9 I-44122 Ferrara, Italy Tel: +39 0532 1861501 Fax: +39 0532 1861637 http://www.meeo.it ======================================== "ATTENZIONE:le informazioni contenute in questo messaggio sono da considerarsi confidenziali ed il loro utilizzo è riservato unicamente al destinatario sopra indicato. Chi dovesse ricevere questo messaggio per errore è tenuto ad informare il mittente ed a rimuoverlo definitivamente da ogni supporto elettronico o cartaceo." "WARNING:This message contains confidential and/or proprietary information which may be subject to privilege or immunity and which is intended for use of its addressee only. Should you receive this message in error, you are kindly requested to inform the sender and to definitively remove it from any paper or electronic format."

On 08/30/2011 11:08 AM, Alessandro Candini wrote:
My code (simplyfication of this: http://www.boost.org/doc/libs/1_47_0/doc/html/boost_asio/tutorial/tuttimer1/...):
#include <iostream> #include </usr/local/include/boost/asio.hpp> // Boost version 1.47.0 int main() { return 0; }
Compilation command: g++ -Wall -o timer1 timer1.cpp
Error: /tmp/ccGUgnoD.o: In function `__static_initialization_and_destruction_0(int, int)': timer1.cpp:(.text+0x52): undefined reference to `boost::system::generic_category()' timer1.cpp:(.text+0x5e): undefined reference to `boost::system::generic_category()' timer1.cpp:(.text+0x6a): undefined reference to `boost::system::system_category()' /tmp/ccGUgnoD.o: In function `boost::asio::error::get_system_category()': timer1.cpp:(.text._ZN5boost4asio5error19get_system_categoryEv[boost::asio::error::get_system_category()]+0x5): undefined reference to `boost::system::system_category()' /tmp/ccGUgnoD.o: In function `boost::asio::detail::posix_tss_ptr_create(unsigned int&)': timer1.cpp:(.text._ZN5boost4asio6detail20posix_tss_ptr_createERj[boost::asio::detail::posix_tss_ptr_create(unsigned int&)]+0x19): undefined reference to `pthread_key_create' /tmp/ccGUgnoD.o: In function `boost::asio::detail::posix_tss_ptr<boost::asio::detail::call_stack<boost::asio::detail::task_io_service>::context>::~posix_tss_ptr()': timer1.cpp:(.text._ZN5boost4asio6detail13posix_tss_ptrINS1_10call_stackINS1_15task_io_serviceEE7contextEED2Ev[_ZN5boost4asio6detail13posix_tss_ptrINS1_10call_stackINS1_15task_io_serviceEE7contextEED5Ev]+0x15): undefined reference to `pthread_key_delete' /tmp/ccGUgnoD.o: In function `boost::asio::detail::posix_tss_ptr<boost::asio::detail::call_stack<boost::asio::detail::strand_service::strand_impl>::context>::~posix_tss_ptr()': timer1.cpp:(.text._ZN5boost4asio6detail13posix_tss_ptrINS1_10call_stackINS1_14strand_service11strand_implEE7contextEED2Ev[_ZN5boost4asio6detail13posix_tss_ptrINS1_10call_stackINS1_14strand_service11strand_implEE7contextEED5Ev]+0x15): undefined reference to `pthread_key_delete' collect2: ld returned 1 exit status make: *** [all] Error 1
Any ideas?
Thanks in advance.
What platform are you trying to build that for? Regards -- Dipl.-Ing. (FH) Andreas Wehrmann Software Development -------------------------------------------------------------- Center Communication Systems GmbH A-1210 Wien, Ignaz-Köck-Straße 19 Sitz in Wien FN 796 88p, Firmenbuchgericht Wien www.centersystems.com Tel.: +43 (0) 190 199 - 3616 Mobile: +43 (0) 664 884 75916 Fax: +43 (0) 190 199 - 2110 E-Mail: a.wehrmann@centersystems.com

On 30/08/11 12:04, Andreas Wehrmann wrote:
On 08/30/2011 11:08 AM, Alessandro Candini wrote:
My code (simplyfication of this: http://www.boost.org/doc/libs/1_47_0/doc/html/boost_asio/tutorial/tuttimer1/...):
#include <iostream> #include </usr/local/include/boost/asio.hpp> // Boost version 1.47.0 int main() { return 0; }
Compilation command: g++ -Wall -o timer1 timer1.cpp
Error: /tmp/ccGUgnoD.o: In function `__static_initialization_and_destruction_0(int, int)': timer1.cpp:(.text+0x52): undefined reference to `boost::system::generic_category()' timer1.cpp:(.text+0x5e): undefined reference to `boost::system::generic_category()' timer1.cpp:(.text+0x6a): undefined reference to `boost::system::system_category()' /tmp/ccGUgnoD.o: In function `boost::asio::error::get_system_category()': timer1.cpp:(.text._ZN5boost4asio5error19get_system_categoryEv[boost::asio::error::get_system_category()]+0x5): undefined reference to `boost::system::system_category()' /tmp/ccGUgnoD.o: In function `boost::asio::detail::posix_tss_ptr_create(unsigned int&)': timer1.cpp:(.text._ZN5boost4asio6detail20posix_tss_ptr_createERj[boost::asio::detail::posix_tss_ptr_create(unsigned int&)]+0x19): undefined reference to `pthread_key_create' /tmp/ccGUgnoD.o: In function `boost::asio::detail::posix_tss_ptr<boost::asio::detail::call_stack<boost::asio::detail::task_io_service>::context>::~posix_tss_ptr()': timer1.cpp:(.text._ZN5boost4asio6detail13posix_tss_ptrINS1_10call_stackINS1_15task_io_serviceEE7contextEED2Ev[_ZN5boost4asio6detail13posix_tss_ptrINS1_10call_stackINS1_15task_io_serviceEE7contextEED5Ev]+0x15): undefined reference to `pthread_key_delete' /tmp/ccGUgnoD.o: In function `boost::asio::detail::posix_tss_ptr<boost::asio::detail::call_stack<boost::asio::detail::strand_service::strand_impl>::context>::~posix_tss_ptr()': timer1.cpp:(.text._ZN5boost4asio6detail13posix_tss_ptrINS1_10call_stackINS1_14strand_service11strand_implEE7contextEED2Ev[_ZN5boost4asio6detail13posix_tss_ptrINS1_10call_stackINS1_14strand_service11strand_implEE7contextEED5Ev]+0x15): undefined reference to `pthread_key_delete' collect2: ld returned 1 exit status make: *** [all] Error 1
Any ideas?
Thanks in advance.
What platform are you trying to build that for?
Regards
A 64 bit architecture: Linux office-007 2.6.38-11-generic #48-Ubuntu SMP Fri Jul 29 19:02:55 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux -- Alessandro Candini MEEO S.r.l. Via Saragat 9 I-44122 Ferrara, Italy Tel: +39 0532 1861501 Fax: +39 0532 1861637 http://www.meeo.it ======================================== "ATTENZIONE:le informazioni contenute in questo messaggio sono da considerarsi confidenziali ed il loro utilizzo è riservato unicamente al destinatario sopra indicato. Chi dovesse ricevere questo messaggio per errore è tenuto ad informare il mittente ed a rimuoverlo definitivamente da ogni supporto elettronico o cartaceo." "WARNING:This message contains confidential and/or proprietary information which may be subject to privilege or immunity and which is intended for use of its addressee only. Should you receive this message in error, you are kindly requested to inform the sender and to definitively remove it from any paper or electronic format."

On 08/30/2011 12:09 PM, Alessandro Candini wrote:
On 30/08/11 12:04, Andreas Wehrmann wrote:
On 08/30/2011 11:08 AM, Alessandro Candini wrote:
My code (simplyfication of this: http://www.boost.org/doc/libs/1_47_0/doc/html/boost_asio/tutorial/tuttimer1/...):
#include <iostream> #include </usr/local/include/boost/asio.hpp> // Boost version 1.47.0 int main() { return 0; }
Compilation command: g++ -Wall -o timer1 timer1.cpp
Error: /tmp/ccGUgnoD.o: In function `__static_initialization_and_destruction_0(int, int)': timer1.cpp:(.text+0x52): undefined reference to `boost::system::generic_category()' timer1.cpp:(.text+0x5e): undefined reference to `boost::system::generic_category()' timer1.cpp:(.text+0x6a): undefined reference to `boost::system::system_category()' /tmp/ccGUgnoD.o: In function `boost::asio::error::get_system_category()': timer1.cpp:(.text._ZN5boost4asio5error19get_system_categoryEv[boost::asio::error::get_system_category()]+0x5): undefined reference to `boost::system::system_category()' /tmp/ccGUgnoD.o: In function `boost::asio::detail::posix_tss_ptr_create(unsigned int&)': timer1.cpp:(.text._ZN5boost4asio6detail20posix_tss_ptr_createERj[boost::asio::detail::posix_tss_ptr_create(unsigned int&)]+0x19): undefined reference to `pthread_key_create' /tmp/ccGUgnoD.o: In function `boost::asio::detail::posix_tss_ptr<boost::asio::detail::call_stack<boost::asio::detail::task_io_service>::context>::~posix_tss_ptr()': timer1.cpp:(.text._ZN5boost4asio6detail13posix_tss_ptrINS1_10call_stackINS1_15task_io_serviceEE7contextEED2Ev[_ZN5boost4asio6detail13posix_tss_ptrINS1_10call_stackINS1_15task_io_serviceEE7contextEED5Ev]+0x15): undefined reference to `pthread_key_delete' /tmp/ccGUgnoD.o: In function `boost::asio::detail::posix_tss_ptr<boost::asio::detail::call_stack<boost::asio::detail::strand_service::strand_impl>::context>::~posix_tss_ptr()': timer1.cpp:(.text._ZN5boost4asio6detail13posix_tss_ptrINS1_10call_stackINS1_14strand_service11strand_implEE7contextEED2Ev[_ZN5boost4asio6detail13posix_tss_ptrINS1_10call_stackINS1_14strand_service11strand_implEE7contextEED5Ev]+0x15): undefined reference to `pthread_key_delete' collect2: ld returned 1 exit status make: *** [all] Error 1
Any ideas?
Thanks in advance.
What platform are you trying to build that for?
Regards
A 64 bit architecture:
Linux office-007 2.6.38-11-generic #48-Ubuntu SMP Fri Jul 29 19:02:55 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
You need to link against the boost_system library "-lboost_system". Btw. the subject is somewhat irritating as ASIO does indeed compile but your program fails to link. -- Dipl.-Ing. (FH) Andreas Wehrmann Software Development -------------------------------------------------------------- Center Communication Systems GmbH A-1210 Wien, Ignaz-Köck-Straße 19 Sitz in Wien FN 796 88p, Firmenbuchgericht Wien www.centersystems.com Tel.: +43 (0) 190 199 - 3616 Mobile: +43 (0) 664 884 75916 Fax: +43 (0) 190 199 - 2110 E-Mail: a.wehrmann@centersystems.com

On Tuesday, August 30, 2011 11:08:56 AM Alessandro Candini wrote:
My code (simplyfication of this: http://www.boost.org/doc/libs/1_47_0/doc/html/boost_asio/tutorial/tuttimer1/ src.html):
Being pedantic ... It does compile, the linker doesn't find the symbols. You need to link against the boost system and pthread library
#include <iostream> #include </usr/local/include/boost/asio.hpp> // Boost version 1.47.0 int main() { return 0; }
Compilation command: g++ -Wall -o timer1 timer1.cpp
Error: /tmp/ccGUgnoD.o: In function `__static_initialization_and_destruction_0(int, int)': timer1.cpp:(.text+0x52): undefined reference to `boost::system::generic_category()' timer1.cpp:(.text+0x5e): undefined reference to `boost::system::generic_category()' timer1.cpp:(.text+0x6a): undefined reference to `boost::system::system_category()' /tmp/ccGUgnoD.o: In function `boost::asio::error::get_system_category()': timer1.cpp:(.text._ZN5boost4asio5error19get_system_categoryEv[boost::asio::e rror::get_system_category()]+0x5): undefined reference to `boost::system::system_category()' /tmp/ccGUgnoD.o: In function `boost::asio::detail::posix_tss_ptr_create(unsigned int&)': timer1.cpp:(.text._ZN5boost4asio6detail20posix_tss_ptr_createERj[boost::asio ::detail::posix_tss_ptr_create(unsigned int&)]+0x19): undefined reference to `pthread_key_create' /tmp/ccGUgnoD.o: In function `boost::asio::detail::posix_tss_ptr<boost::asio::detail::call_stack<boost::a sio::detail::task_io_service>::context>::~posix_tss_ptr()': timer1.cpp:(.text._ZN5boost4asio6detail13posix_tss_ptrINS1_10call_stackINS1 _15task_io_serviceEE7contextEED2Ev[_ZN5boost4asio6detail13posix_tss_ptrINS1_ 10call_stackINS1_15task_io_serviceEE7contextEED5Ev]+0x15): undefined reference to `pthread_key_delete' /tmp/ccGUgnoD.o: In function `boost::asio::detail::posix_tss_ptr<boost::asio::detail::call_stack<boost::a sio::detail::strand_service::strand_impl>::context>::~posix_tss_ptr()': timer1.cpp:(.text._ZN5boost4asio6detail13posix_tss_ptrINS1_10call_stackINS1 _14strand_service11strand_implEE7contextEED2Ev[_ZN5boost4asio6detail13posix_ tss_ptrINS1_10call_stackINS1_14strand_service11strand_implEE7contextEED5Ev]+ 0x15): undefined reference to `pthread_key_delete' collect2: ld returned 1 exit status make: *** [all] Error 1
Any ideas?
Thanks in advance.

On 30/08/11 12:07, Thomas Heller wrote:
On Tuesday, August 30, 2011 11:08:56 AM Alessandro Candini wrote:
My code (simplyfication of this: http://www.boost.org/doc/libs/1_47_0/doc/html/boost_asio/tutorial/tuttimer1/ src.html): Being pedantic ... It does compile, the linker doesn't find the symbols. You need to link against the boost system and pthread library
#include<iostream> #include</usr/local/include/boost/asio.hpp> // Boost version 1.47.0 int main() { return 0; }
Compilation command: g++ -Wall -o timer1 timer1.cpp
Error: /tmp/ccGUgnoD.o: In function `__static_initialization_and_destruction_0(int, int)': timer1.cpp:(.text+0x52): undefined reference to `boost::system::generic_category()' timer1.cpp:(.text+0x5e): undefined reference to `boost::system::generic_category()' timer1.cpp:(.text+0x6a): undefined reference to `boost::system::system_category()' /tmp/ccGUgnoD.o: In function `boost::asio::error::get_system_category()': timer1.cpp:(.text._ZN5boost4asio5error19get_system_categoryEv[boost::asio::e rror::get_system_category()]+0x5): undefined reference to `boost::system::system_category()' /tmp/ccGUgnoD.o: In function `boost::asio::detail::posix_tss_ptr_create(unsigned int&)': timer1.cpp:(.text._ZN5boost4asio6detail20posix_tss_ptr_createERj[boost::asio ::detail::posix_tss_ptr_create(unsigned int&)]+0x19): undefined reference to `pthread_key_create' /tmp/ccGUgnoD.o: In function `boost::asio::detail::posix_tss_ptr<boost::asio::detail::call_stack<boost::a sio::detail::task_io_service>::context>::~posix_tss_ptr()': timer1.cpp:(.text._ZN5boost4asio6detail13posix_tss_ptrINS1_10call_stackINS1 _15task_io_serviceEE7contextEED2Ev[_ZN5boost4asio6detail13posix_tss_ptrINS1_ 10call_stackINS1_15task_io_serviceEE7contextEED5Ev]+0x15): undefined reference to `pthread_key_delete' /tmp/ccGUgnoD.o: In function `boost::asio::detail::posix_tss_ptr<boost::asio::detail::call_stack<boost::a sio::detail::strand_service::strand_impl>::context>::~posix_tss_ptr()': timer1.cpp:(.text._ZN5boost4asio6detail13posix_tss_ptrINS1_10call_stackINS1 _14strand_service11strand_implEE7contextEED2Ev[_ZN5boost4asio6detail13posix_ tss_ptrINS1_10call_stackINS1_14strand_service11strand_implEE7contextEED5Ev]+ 0x15): undefined reference to `pthread_key_delete' collect2: ld returned 1 exit status make: *** [all] Error 1
Any ideas?
Thanks in advance.
Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users You are right! With the following compilation line, it compiles and links like a charm:
g++ -Wall -pedantic -pthread -lboost_system -o timer1 timer1.cpp Thank you! -- Alessandro Candini MEEO S.r.l. Via Saragat 9 I-44122 Ferrara, Italy Tel: +39 0532 1861501 Fax: +39 0532 1861637 http://www.meeo.it ======================================== "ATTENZIONE:le informazioni contenute in questo messaggio sono da considerarsi confidenziali ed il loro utilizzo è riservato unicamente al destinatario sopra indicato. Chi dovesse ricevere questo messaggio per errore è tenuto ad informare il mittente ed a rimuoverlo definitivamente da ogni supporto elettronico o cartaceo." "WARNING:This message contains confidential and/or proprietary information which may be subject to privilege or immunity and which is intended for use of its addressee only. Should you receive this message in error, you are kindly requested to inform the sender and to definitively remove it from any paper or electronic format."
participants (3)
-
Alessandro Candini
-
Andreas Wehrmann
-
Thomas Heller