On 8 February 2013 16:03, Giovanni wrote:
I followed your instructions to link the libraries, with the
"-lboost_filesystem -lboost_system" sequence of linking the
aforementioned Boost C++ libraries.
However, I cannot resolve the linking error. I have included a
snippet from my Terminal session below.
No idea what's wrong really and have no time to investigate it.
But, I've done quick test on Ubuntu 10.04 using Boost 1.40
installed from its packages and small sample from this book
http://en.highscore.de/cpp/boost/errorhandling.html
and it worked for me:
Here is my console log:
mloskot@vb-ubuntu104-x64:~/tmp$ /usr/bin/lsb_release -d
Description: Ubuntu 10.04.4 LTS
mloskot@vb-ubuntu104-x64:~/tmp$ cat bsystem.cpp
#include
#include <iostream>
#include <string>
class application_category :
public boost::system::error_category
{
public:
const char *name() const { return "application"; }
std::string message(int ev) const { return "error message"; }
};
application_category cat;
int main()
{
boost::system::error_code ec(14, cat);
std::cout << ec.value() << std::endl;
std::cout << ec.category().name() << std::endl;
}
mloskot@vb-ubuntu104-x64:~/tmp$ g++ -L/usr/lib -lboost_system bsystem.cpp
mloskot@vb-ubuntu104-x64:~/tmp$ ./a.out
14
application
mloskot@vb-ubuntu104-x64:~/tmp$ ldd ./a.out |grep boost
libboost_system.so.1.40.0 => /usr/lib/libboost_system.so.1.40.0
(0x00007f2df87b6000)
Perhaps something has changed in later versions.
I have no time to dig it deeper, sorry.
Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net