开发者

Problem with boost library in C++ project

I'm attempting to us开发者_开发技巧e the boost library in my C++ project (Visual Studio 2008). However on including the boost functions for time:

 #include <boost/date_time/gregorian/gregorian.hpp>  

I get the following error (along with a number of warnings):

 fatal error LNK1104: cannot open file 'libboost_date_time-vc90-mt-gd-1_44.lib'

The file 'libboost_date_time-vc90-mt-gd-1_44.lib' is present on my machine and I've used the boost library before without any difficulties.

Any idea what might be wrong?


The linker cannot find the library file. This could mean that it is not searching in the correct directories. In the properties of the project you should go to the Linker section and make sure that the boost dir is correctly spelled out. Right click on the project, click on Properties -> Configuration properties -> Linker -> Input and you will find "Additional dependencies".

System wide you can go to Tools -> Options -> Projects and solutions -> VC++ Directories, then pick "Library files" in the pull down menu on the right.

If I recall correctly the boost pro installer takes care of this.


Globally: Tools --> Options --> Projects and Solutions --> VC++ Directories "Library files" (as already answered above)

Per project: Project Properties --> Linker --> General --> Additional Library Directories


Did you use any libraries before that required the Boost binary libraries for linkage? Many of the Boost libs are header-only - if you haven't previously used ones that aren't, then that's why you are hitting this now, and the solution is as posted by others - make sure they are present on your build box and set up the build env to reference them.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜