对于如下程序:
#include <iostream> #include <boost/asio.hpp> #include <boost/date_time/posix_time/posix_time.hpp> using namespace std; int main() { boost::asio::io_service io; boost::asio::deadline_timer t(io, boost::posix_time::seconds(5)); t.wait(); cout << "Hello World! " << endl; return 0; }
在Visual Studio 2010下编译出现如下错误:
1>LINK : fatal error LNK1104: cannot open file 'libboost_system-vc100-mt-gd-1_54.lib'
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:36.95
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
解决方法如下:
1.首先运行D:oost_1_54_0目录下的bootstrap.bat文件。此时在该目录下生成文件b2.ext
2.执行b2.exe文件,在当前目录下生成/stage/lib
3.把生成的lib文件加入到工程文件中即可。