0

I have succesfull build Boost.CMake and got .lib fils in to build/lib derectory. But thry are not in correct namin convention. So I got fallowing error. How can I solve this problem?

------ Rebuild All started: Project: Test, Configuration: Release Win32 ------
Deleting intermediate and output files for project 'Test', configuration 'Release|Win32'
Compiling...
Main.cpp
Linking...
LINK : fatal error LNK1104: cannot open file 'libboost_regex-vc90-mt-1_47.lib'
Build log was saved at "file://c:\Users\Chameera\Documents\Visual Studio 2008\Projects\Test\Test\Release\BuildLog.htm"
Test - 1 error(s), 0 warning(s)

========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
Chameera
  • 82
  • 8
  • Is libboost_regex-vc90-mt-1_47.lib in library path? Is this a 32 bit library? – drescherjm Jan 17 '14 at 19:18
  • I Just want to do this renaming by CMakeList.txt it self. Is it posible? – Chameera Jan 18 '14 at 09:55
  • @Chameera I know CMake very well (since I use it for all of my projects for years - yes some of these use boost and Visual Studio). However your last question does not make any sense to me at all. – drescherjm Jan 18 '14 at 14:09
  • Are you trying to supply a different version of the boost libraray? Did you change the naming convention? – drescherjm Jan 18 '14 at 14:11
  • @drescherjm after build Boost using CMake it generate lib file with name boost_regex-vc90-mt-1_47.lib. How can I rename it to correct name? – Chameera Jan 19 '14 at 14:30
  • You do not rename it, because it's the difference between dynamic and static libs. The solution is setting the preprocessor symbol ``BOOST_ALL_DYN_LINK``, see https://stackoverflow.com/a/3051417/893159 – allo Apr 14 '17 at 20:48
  • Probably you will need to experiment a bit until everything works, reading FindBoost.cmake helps a bit. for debugging you can use ``message("libs: ${Boost_LIBRARIES}")`` and look what libs you get. They should have absolute paths, so you do not need to define any link-directories and the cmake docs even recommend not changing them. – allo Apr 14 '17 at 20:51

1 Answers1

-1

The error is because the compiler can't find the libboost_regex-vc90-mt-1_47.lib which is the regex library from boost. If you already have that lib, add to the library directory, if not, build the library. Here is how.

jfly
  • 7,715
  • 3
  • 35
  • 65
  • I have build Boost using Cmake. So actual build lib file name is boost_regex-vc90-mt-1_47.lib. How can I manage it? – Chameera Jan 19 '14 at 14:28
  • 1
    It seems you are using CMake, put the following 2 lines in your CMakeLists.txt: link_directories(YOUR_LIB_FILE_PATH) target_link_libraries (YOUR_OUTPUT YOUR_LIB_FILE), if the lib file name doesn't match, just rename it. – jfly Jan 20 '14 at 02:55