Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

boost problem in windows 7

Tags:

c++

boost

I have written the following code

#include <iostream>
#include <boost/asio.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/filesystem.hpp>
#include <boost/system/windows_error.hpp>

using namespace boost::system;

int main(){

    boost::asio::io_service io;
    boost::asio::deadline_timer t(io,boost::posix_time::seconds(5));
    t.wait();
    std::cout<<"hello world";
    return 0;
}

and I get the following error:

1>LINK : fatal error LNK1104: cannot open file 'libboost_system-vc100-mt-gd-1_44.lib'

I dont know how and what do, can you please explain what is happening and what steps I can take to fix it?

like image 519
user439547 Avatar asked Sep 04 '10 14:09

user439547


3 Answers

Ok, for MSVC++ 2010

Under Project Properties, goto

Configuration Properties -> Linker -> General -> Additional Library Directories and add there the path to the *.lib file (For example: C:\boost_1_41_0\stage\lib)

like image 194
Prasoon Saurav Avatar answered Oct 26 '22 17:10

Prasoon Saurav


As far as I can tell from the error message it compiles but can't find the boost compiled libraries.

These you have to build yourselves unless you can find them prebuilt.

IIRC boost are built using a tool called bjam. I think this explains it rather throughly: http://www.highscore.de/cpp/boostbuild/index.html.

After it's built you have to instruct the compiler to link it using the project properties.

like image 1
Just another metaprogrammer Avatar answered Oct 26 '22 18:10

Just another metaprogrammer


I suspect you haven't built the libraries. You can get the pre-built libraries from BoostPro or you can build them yourself following the instructions at http://www.boost.org/doc/libs/1_44_0/more/getting_started/windows.html

like image 1
Nick Strupat Avatar answered Oct 26 '22 16:10

Nick Strupat