views:

1236

answers:

4

I'm just getting started with Boost for the first time, details:

  1. I'm using Visual Studio 2008 SP1
  2. I'm doing an x64 Build
  3. I'm using boost::asio only (and any dependencies it has)

My code now compiles, and I pointed my project at the boost libraries (after having built x64 libs) and got past simple issues, now I am facing a linker error:

2>BaseWebServer.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::get_system_category(void)" (?get_system_category@system@boost@@YAAEBVerror_category@12@XZ) 2>BaseWebServer.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::get_generic_category(void)" (?get_generic_category@system@boost@@YAAEBVerror_category@12@XZ)

any ideas?

thx!

+1  A: 

You need to link in the boost_system library

Maik Beckmann
Does it not get auto-linked in? The other libraries seem to. Whats the correct way to link it in? (Given all the variations of the library etc)
Alex Black
Funny thing is, the first error I got was: fatal error LNK1104: cannot open file 'libboost_system-vc90-mt-1_38.lib'. I then made sure that library was in the lib path and it went away.
Alex Black
Add the import library (boost_system.??.lib) at your Project settings.
Maik Beckmann
its already finding it though.
Alex Black
I added libboost_system-vc90-mt-1_38.lib to my list of libraries, same error.
Alex Black
any other ideas?
Alex Black
A: 

I added this define: #define BOOST_LIB_DIAGNOSTIC

And now in my output I see this:

1>Linking to lib file: libboost_system-vc90-mt-1_38.lib
1>Linking to lib file: libboost_date_time-vc90-mt-1_38.lib
1>Linking to lib file: libboost_regex-vc90-mt-1_38.lib

which seems to indicate it is infact linking in the system lib.

Alex Black
+1  A: 

Solved the problem. I had built 32bit libs when I had intended to build 64bit libs. I fixed up my build statement, and built 64bit libraries and now it works.

Here is my bjam command line:

C:\Program Files (x86)\boost\boost_1_38>bjam --build-dir=c:\boost --build-type=complete --toolset=msvc-9.0 address-model=64 architecture=x86 --with-system
Alex Black
A: 

Alex,

Thank you for sharing your answer. I tried it on Boost 1.40.0 and it works with VS 2008. You saved me a lot of time.