C ++ / Boost: пример неопределенных символов?

Пример, который я пытаюсь скомпилировать, взят из: http://www.boost.org/ doc / libs / 1_46_1 / doc / html / boost_asio / examples.html (пример чата)

Вот что я использую для его создания:

>>>    g++ chat_client.cpp chat_message.hpp
>>>    g++ chat_server.cpp chat_message.hpp

Вот что выводит терминал:

% g++ chat_client.cpp chat_message.hpp
In file included from chat_client.cpp:17:
chat_message.hpp: In member function ‘void chat_message::encode_header()’:
chat_message.hpp:84: warning: format ‘%4d’ expects type ‘int’, but argument 3 has type ‘size_t’
ld: warning: in chat_message.hpp, file was built for unsupported file format which is not the architecture being linked (x86_64)
Undefined symbols:
  "boost::system::generic_category()", referenced from:
      __static_initialization_and_destruction_0(int, int)in cctJA2c1.o
      __static_initialization_and_destruction_0(int, int)in cctJA2c1.o
  "boost::thread::start_thread()", referenced from:
      boost::thread::thread, boost::_bi::list1 > > >(boost::_bi::bind_t, boost::_bi::list1 > >, boost::disable_if, boost::_bi::list1 > >&, boost::detail::thread_move_t, boost::_bi::list1 > > > >, boost::thread::dummy*>::type)in cctJA2c1.o
  "boost::thread::join()", referenced from:
      _main in cctJA2c1.o
  "typeinfo for boost::detail::thread_data_base", referenced from:
      typeinfo for boost::detail::thread_data, boost::_bi::list1 > > >in cctJA2c1.o
  "vtable for boost::detail::thread_data_base", referenced from:
      boost::detail::thread_data_base::thread_data_base()in cctJA2c1.o
  "boost::thread::~thread()", referenced from:
      _main in cctJA2c1.o
      _main in cctJA2c1.o
  "boost::detail::thread_data_base::~thread_data_base()", referenced from:
      boost::detail::thread_data, boost::_bi::list1 > > >::~thread_data()in cctJA2c1.o
      boost::detail::thread_data, boost::_bi::list1 > > >::~thread_data()in cctJA2c1.o
  "boost::system::system_category()", referenced from:
      boost::system::get_system_category()     in cctJA2c1.o
      boost::system::error_code::error_code()in cctJA2c1.o
      __static_initialization_and_destruction_0(int, int)in cctJA2c1.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
  • Boost установлен правильно. У меня есть еще одно приложение, в котором используется пара битовых функций Boost.

ОБНОВЛЕНИЕ: это текущая команда, которую я использую:

% g++ chat_client.cpp chat_message.hpp -lboost_asio -lboost_thread -o client -L/opt/local/lib/

говорит, что не может найти -lboost_asio

Я посмотрел в opt / local / lib (где установлен boost), и я не вижу libboost_asio.so или чего-то еще как это = \

6
задан NullVoxPopuli 28 April 2011 в 14:59
поделиться