Error LNK2019: unresolved external symbol "class boost::system::error_category

The question was asked: 6 years 9 months ago   views: 26
0
#include "stdafx.h" #include <iostream> #include <boost/asio.hpp> #include <conio.h> #include <stdio.h> #include <fstream> #include <string> using namespace std; // ... int main() { boost::asio::ip::tcp::iostream stream; stream.expires_from_now(boost::posix_time::seconds(60)); // ... system("pause"); return 0; }

And that's what

'Error 3 error LNK2019: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAABVerror_category@12@XZ) referenced in function "public: __thiscall boost::system::error_code::error_code(void)" (??0error_code@system@boost@@QAE@XZ) c:\Users\Gen\documents\visual studio 2012\Projects\ConsoleApplication2\ConsoleApplication2\ConsoleApplication2.obj core2 Error 4 error LNK2019: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAABVerror_category@12@XZ) referenced in function "void __cdecl boost::system::'dynamic initializer for 'errno_ecat"(void)" (??__Eerrno_ecat@system@boost@@YAXXZ) c:\Users\Gen\documents\visual studio 2012\Projects\ConsoleApplication2\ConsoleApplication2\ConsoleApplication2.obj core2 Error 5 error LNK1120: 2 unresolved externals c:\users\gen\documents\visual studio 2012\Projects\ConsoleApplication2\Debug\core2.exe 1 1 core2'

Now I downloaded the latest boost. Copied your code from the post and I got it without a single error compiled. The main set of project folders which contain the header files and static libraries. - 14-11-2012 в 02:14:35

Answers   2

0

Try to connect the library boost_system

Answered: 13-11-2012 в 13:25:42
To enable this you should write to the header Right ? #include - 13-11-2012 в 13:30:25
no. Not only. Need in libraries (libraries), add the desired file. - 13-11-2012 в 13:31:59
No, it must be somewhere in the project properties to specify the linking library boost_system.dll - 13-11-2012 в 13:32:10
By the way, the header can be omitted. It is already included in the headers boost_asio which depends on this library. Butovskie libraries depend on it. - 13-11-2012 в 13:33:20
Sorry I do not understand how to add:( . Even did a search for this DLL in the folder with buttom still not founded) can be explained as for the stupid ?) - 13-11-2012 в 13:41:43
0

On the header I see that you are compiling in the Studio.

Insert after headerrow line.

#pragma comment(lib, "boost_system.lib")

well, or what's the name of this library.

In General, you compile boost itself?
In the Studio, specify the path to the libraries and will you happiness.

I have this library called:
libboost_system-vc100-mt-1_52.lib for Release
or
libboost_system-vc100-mt-gd-1_52.lib for Debug

Answered: 13-11-2012 в 13:43:56
Yes I compiled myself,the way like as indicated ( does not swear on include as far as I know) but even your method does not see the library - 13-11-2012 в 13:55:27
Well, if you are in the settings of the Studio has not specified the path to lib files, in the command I wrote above, you need to enter the full path to the library. - 13-11-2012 в 13:56:37
If such a library is not (very strange), it can be found [here][1]. [1]: sourceforge.net/projects/boost/files/boost-binaries - 13-11-2012 в 14:00:11
[How to compile boost in the dll.][1] [1]: boost.2283326.n4.nabble.com/Building-Boost-DLLs-td2695730.html - 13-11-2012 в 14:11:48