krisdigitx
krisdigitx

Reputation: 7126

boost asio example test fails

I am running a simple example of boost asio on fedora xfce..and it gives these errors ...any idea?

#include <boost/asio.hpp>
#include <iostream>

int main( int argc, char * argv[] )
{
    boost::asio::io_service io_service;

    io_service.run();

    std::cout << "Do you reckon this line displays?" << std::endl;

    return 0;
}

output:

obj/Debug/main.o||In function `__static_initialization_and_destruction_0':|
/usr/include/boost/system/error_code.hpp|214|undefined reference to `boost::system::generic_category()'|
/usr/include/boost/system/error_code.hpp|215|undefined reference to `boost::system::generic_category()'|
/usr/include/boost/system/error_code.hpp|216|undefined reference to `boost::system::system_category()'|
obj/Debug/main.o||In function `boost::system::error_code::error_code()':|
/usr/include/boost/system/error_code.hpp|315|undefined reference to `boost::system::system_category()'|
obj/Debug/main.o||In function `boost::asio::error::get_system_category()':|
/usr/include/boost/asio/error.hpp|216|undefined reference to `boost::system::system_category()'|
||=== Build finished: 5 errors, 0 warnings (0 minutes, 1 seconds) ===|

Upvotes: 0

Views: 242

Answers (1)

chill
chill

Reputation: 16888

You need to link to libboost_system, e.g. c++ you-file.cxx -lboost_system

Upvotes: 3

Related Questions