Frage

Ich habe nur wenige Probleme, während ich mich mit Boost -Bibliotheken verlinke. Ich versuche auszuführen Einfaches Timer -Programm

Aber wenn ich das Programm ausführe, um unter Fehler zu gelangen

~/boost_1_48_0/boost/asio/detail/impl/posix_tss_ptr.ipp:34: undefined reference to `pthread_key_create'
./timer.o: In function `~posix_tss_ptr': /~/boost_1_48_0/boost/asio/detail/posix_tss_ptr.hpp:48: undefined reference to `pthread_key_delete' 
./timer.o: In function `boost::asio::detail::posix_tss_ptr<boost::asio::detail::call_stack<boost::asio::detail::task_io_service, boost::asio::detail::task_io_service::thread_info>::context>::operator boost::asio::detail::call_stack<boost::asio::detail::task_io_service, boost::asio::detail::task_io_service::thread_info>::context*() const': ~/boost_1_48_0/boost/asio/detail/posix_tss_ptr.hpp:54: undefined reference to `pthread_getspecific'
./timer.o: In function `~posix_tss_ptr': ~/boost_1_48_0/boost/asio/detail/posix_tss_ptr.hpp:48: undefined reference to `pthread_key_delete' collect2: ld returned 1 exit status

Ich habe eingeschlossen _I ~/boost_1_48_0/ -L ~/boost_1_48_0/stage/lib -lboost-system

Irgendwelche schnellen Hinweise darauf?

War es hilfreich?

Lösung

Haben Sie sich daran erinnert, festzulegen? -pthread auch? Von GCC Manpage:

   -pthread
       Add support for multithreading using the POSIX threads library.
       This option sets flags for both the preprocessor and linker.

Es ist mit Code erforderlich, der POSIX -Threads verwendet.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top