我的程序找不到boost库
我尝试编写 Boost 测试库示例的代码:
#include <boost/unit_test.hpp>
BOOST_AUTO_TEST_CASE(test)
{
BOOST_CHECK(true);
}
我构建了源代码,并获得了执行文件 test.exe
。我尝试执行该文件,但收到错误消息。
程序无法启动,因为您的计算机中缺少 boost_unit_test_framework-vc80-mt-1_44.dll。尝试重新安装程序来解决此问题。
但是,我已经在我的 boost 库目录中准备好了该文件。
这个案例有什么问题呢?
背景: 对于我的构建环境,我使用 Windows 7 Ultimate x64 和 Visual Studio 2005。 于是我自己搭建了boost库,得到了64位计算系统的所有库。
使用 bjam,我在 64 位命令提示符窗口中使用命令:bjam --toolset=mvsc-8.0 address-model=64 threading=multi --build-system=complete install
。
构建后,我在 Visual Studio 目录路径选项中设置了 boost 库和头目录。
谢谢大家!
I tried to write code that was a sample of the Boost test library:
#include <boost/unit_test.hpp>
BOOST_AUTO_TEST_CASE(test)
{
BOOST_CHECK(true);
}
I built the source code, and I got the execution file test.exe
. I tried to execute that file, but I got an error message.
The program can't start because boost_unit_test_framework-vc80-mt-1_44.dll is missing from your computer. Try reinstalling the program to fix this problem.
But, I have ready that file on my boost library directory.
What's the problem in this case?
Background:
For my build environment, I use Windows 7 Ultimate x64, and Visual Studio 2005.
So I built boost library by my self, and I got all the libraries for the 64-bit computing system.
Using bjam, and I use the command: bjam --toolset=mvsc-8.0 address-model=64 threading=multi --build-system=complete install
on 64-bit command prompt window.
After the build, I set the boost library and header directory in Visual Studio directory path option.
Thank you all!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
确保 DLL 的路径包含在“PATH”环境变量中。 (或者如果您愿意,可以将 DLL 包含在您的 exe 目录中)。这样DLL就会被找到。
Make sure that the path to your DLL is included in the "PATH" environment variable. (Or include the DLL in your exe directory if you like). That way the DLL will be found.
您还可以选择使用 Boost 库的静态版本。
构建或下载静态库并将 Visual Studio 指向这些库。 Boost 代码将内置到您的应用程序中(稍微增加其大小),并且您不需要 DLL。
You can also choose to use the static versions of the Boost libraries.
Build or download the static libraries and point Visual Studio at those instead. The Boost code will be built into your application (increasing its size some) and you will not need a DLL.
如果使用 CMake 配置您的应用程序,您可以使用
Boost_USE_STATIC_LIBS
:这样,就不需要 DLL,因为必要的 Boost 定义将通过静态库内置到您的应用程序中。
If using CMake to configure your application, you can tell CMake to use the static versions of the Boost libraries using
Boost_USE_STATIC_LIBS
:This way, the DLLs will not be required, as the requisite Boost definitions will be built into your application via the static libraries.