fatal error LNK1104: cannot open file 'libboost_regex-vc90-mt-gd-1_42.lib'

Deadly 提交于 2019-11-30 05:37:14

Some Boost libraries have to be built; this is one of them. Here's how you can build them:

Make a new file called boost_build.bat, and inside put:

bjam toolset=msvc-9.0 variant=release threading=multi link=static define=_SECURE_SCL=0 define=_HAS_ITERATOR_DEBUGGING=0
bjam toolset=msvc-9.0 variant=debug threading=multi link=static

Note 9.0 refers to VS 2008. (10.0 for 2010, 8.0 for 2005, 7.1 for 2003, 6.0 for, well, 6.0). Once you've done this:

  1. Extract build_boost.bat to <boost_root>

  2. Go to: <boost_root>\tools\jam And run build_dist.bat

  3. Copy <boost_root>\tools\jam\stage\bin.ntx86\bjam.exe to <boost_root>

  4. Run boost_build.bat

  5. Libraries are located in <boost_root>\stage\lib

Note, this is my own method. I would love if someone chimed in an easier way, or some link from Boost; it seems it's difficult to find proper build instructions from Boost.

Once it's built, make sure you let the compiler know where the libraries are in your VC Directories (the Library Paths); add "<boost_root>\stage\lib".


In the bjam defines, I have _SECURE_SCL=0 _HAS_ITERATOR_DEBUGGING=0 for Release. This disables all iterator checking in Release builds, for a speed improvement.

On Windows, the easiest way to get boost binary libraries is to run the installer from BoostPro consulting. Be sure to select your version of Visual Studio and check the box for the regex library during the install.

Have you installed the multithreading debug version of Boost? If not, please do so. Otherwise check your library path (in the project preferences) so that it includes the path to the file mentioned in the error message.

I'm not sure about the define settings, but I was able to get boost to build with MSVC 9.0 by running the <boostroot>\bootstrap batch file, then editing <boostroot>\project-config.jam file as follows. Change the line:

using mvsc

to:

using msvc : 9.0 : cl.exe

then running .\b2 install and the boost headers and libraries were built and installed to c:\boost.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!