3
votes

I am on Visual Studio 2013, downloaded the regular boost libraries (version 1.55) and installed them to C:/Program Files/Boost/

I then created a new empty C++ project and added the following to my "Include Directories":

C:\Program Files\Boost\boost_1_55_0;

This is my code:

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

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

    for (int x = 0; x < 42; ++x)
    {
        io_service.poll();
        std::cout << "Counter: " << x << std::endl;
    }

    return 0;
}

Once bootstrap and ./b2 had finished executing I then added the following path to "Additional Library Dependencies":

C:\Program Files\Boost\boost_1_55_0\stage\lib

but I get the following error messages:

Main.obj : error LNK2019: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAAEBVerror_category@12@XZ) referenced in function "public: __cdecl boost::system::error_code::error_code(void)" (??0error_code@system@boost@@QEAA@XZ)
Main.obj : error LNK2019: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAAEBVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'errno_ecat''(void)" (??__Eerrno_ecat@system@boost@@YAXXZ)

If I go to C:\Program Files\Boost\boost_1_55_0\stage\lib it contains:

  • libboost_system-vc120-mt-1_55
  • libboost_system-vc120-mt-gd-1_55

UPDATE: It appears my headers didn't get built correctly or some where missing. I just downloaded and ran the installer from here:

http://sourceforge.net/projects/boost/files/boost-binaries/1.55.0/

The VS 2013 ones are msvc12

Then I set up my additional library dependencies as normal.

2
I encountered this issue while using the boost auto-linking, and fixed it by adding #include <../boost_libs.h>Pieter

2 Answers

1
votes

These two defines below were messing up with my linker, throwing one beatiful "LNK2001: unresolved external symbol". Do you have then somewhere in your code?

#define BOOST_FILESYSTEM_NO_DEPRECATED
#define BOOST_FILESYSTEM_NO_LIB
1
votes

Try changing /Gd to /Gr in your project settings. It can be due to difference in calling convention.