【发布时间】:2020-12-31 04:54:18
【问题描述】:
我安装了 boost 库,我想对其进行测试。我构建并运行以下项目。但我有一个问题。当我构建项目时:
Info: Internal Builder is used for build
g++ -std=c++0x "-IC:\\boost\\include\\boost-1_68" -O0 -g3 -Wall -c -fmessage-length=0
-o "src\\MyTestProject.o" "..\\src\\MyTestProject.cpp"
g++ "-LC:\\boost\\lib\\" -o MyTestProject.exe "src\\MyTestProject.o" -lws2_32
-llibboost_iostreams-mgw63-mt-x32-1_68
-llibboost_filesystem-mgw63-mt-x32-1_68
-llibboost_system-mgw63-mt-x32-1_68
Build Finished. 0 errors, 0 warnings.
在我单击运行项目后:“信息:没有为 MyTestProject 构建任何内容”并且它不会向 MyTestProject.exe 控制台打印任何内容。
如果我注释掉
#include <iostream>
#include <boost/asio.hpp>
//#include <boost/date_time/posix_time/posix_time.hpp>
using namespace std;
int main()
{
//boost::asio::io_context io;
//boost::asio::deadline_timer t(io, boost::posix_time::seconds(5));
//t.wait();
cout << "Hello world!" << std::endl;
return 0;
}
【问题讨论】:
-
我的第一步是尝试从控制台构建它(使用 eclipse 记录的命令),看看会发生什么。
-
我有,但没有错误@john
-
那么你在运行程序的时候会得到错误返回吗?我能想到的唯一解释是,您的程序在有机会打印任何内容之前就崩溃了,并且可能是在某些 boost 库初始化自身时发生的。
-
是的,约翰,谢谢。我找到了解决方案。它找不到 .dll 文件。我将它添加到项目中并且它可以工作。谢谢@john
标签: c++ eclipse boost boost-asio eclipse-cdt