2

I have installed all boost libraries, but when compiling g++ sda.cpp -lboost_system -lboost_date_time -lboost_regex -lboost_thread -lboost_serialization

#include <boost/asio.hpp>

int main()
{
    return 0;
}

i obtain several errors, and compilation is failed. i use ubuntu 10.10 up to date. Compiler says:

/tmp/cc6bld0N.o: In function `__static_initialization_and_destruction_0(int, int)':
sda.cpp:(.text+0x52): undefined reference to `boost::system::generic_category()'
sda.cpp:(.text+0x5e): undefined reference to `boost::system::generic_category()'
sda.cpp:(.text+0x6a): undefined reference to `boost::system::system_category()'
/tmp/cc6bld0N.o: In function `boost::asio::error::get_system_category()':
sda.cpp:(.text._ZN5boost4asio5error19get_system_categoryEv[boost::asio::error::get_system_category()]+0x5): undefined reference to `boost::system::system_category()'
collect2: ld returned 1 exit status

What is the problem?

Kiril Kirov
  • 37,467
  • 22
  • 115
  • 187
dfk
  • 101
  • 2
  • 3
  • when you say "I have installed all boost libraries" do you mean you installed a compiled version of it or have you built and installed them from source? – yasouser Apr 20 '11 at 14:24

2 Answers2

1

Not likely your problem, but you should not need to link against boost_date_time or boost_regex or boost_serialization or boost_thread.

samm$ cat asio.cc
#include <boost/asio.hpp>

int main()
{
    return 0;
}
samm$ g++ asio.cc  -I /opt/local/include/ -L/opt/local/lib -lboost_system -Wl,-rpath,/opt/local/lib
samm$ 
Sam Miller
  • 23,808
  • 4
  • 67
  • 87
0

IIRC, Ubuntu have *-dev package for development. Are you sure you've installed libboost-dev instead of libboost ?

Kien Truong
  • 11,179
  • 2
  • 30
  • 36