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?
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$
IIRC, Ubuntu have *-dev package for development. Are you sure you've installed libboost-dev instead of libboost ?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.