【问题标题】:fatal error LNK1104: cannot open file 'libboost_regex-vc90-mt-1_47.lib'致命错误 LNK1104:无法打开文件“libboost_regex-vc90-mt-1_47.lib”
【发布时间】:2014-01-17 06:08:59
【问题描述】:

我已成功构建 Boost.CMake 并将 .lib 文件放入 build/lib 目录。但是这不是正确的命名约定。所以我得到了休闲错误。我该如何解决这个问题?

------ 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 ==========

【问题讨论】:

  • libboost_regex-vc90-mt-1_47.lib 在库路径中吗?这是 32 位库吗?
  • 我只想通过 CMakeList.txt 自行重命名。有可能吗?
  • @Chameera 我非常了解 CMake(因为多年来我在所有项目中都使用它——是的,其中一些使用 boost 和 Visual Studio)。但是,您的最后一个问题对我来说根本没有任何意义。
  • 您是否尝试提供不同版本的 boost 库?您是否更改了命名约定?
  • @drescherjm 在使用 CMake 构建 Boost 后生成名为 boost_regex-vc90-mt-1_47.lib 的 lib 文件。如何将其重命名为正确的名称?

标签: c++ boost cmake


【解决方案1】:

错误是因为编译器找不到来自 boost 的正则表达式库 libboost_regex-vc90-mt-1_47.lib。如果您已经拥有该库,请添加到库目录,如果没有,请构建库。 Here 是怎么回事。

【讨论】:

  • 我已经使用 Cmake 构建了 Boost。所以实际的构建库文件名是 boost_regex-vc90-mt-1_47.lib。我该如何管理它?
  • 看来您使用的是 CMake,请将以下 2 行放入您的 CMakeLists.txt 中:link_directories(YOUR_LIB_FILE_PATH) target_link_libraries (YOUR_OUTPUT YOUR_LIB_FILE),如果 lib 文件名不匹配,只需重命名即可。
猜你喜欢
  • 2011-01-17
  • 2011-02-22
  • 2011-06-14
  • 2017-11-04
  • 2012-10-14
  • 1970-01-01
  • 1970-01-01
  • 2016-10-01
  • 1970-01-01
相关资源
最近更新 更多