开发 C++ Boost v1.46.0 链接器问题
我在 Windows XP 上使用 Dev C++,下载了 Boost 包 v 1.46.0 并安装了它。我想用它来创建线程,但我似乎无法编译最简单的代码。
我的代码:
#include <boost/thread.hpp>
using namespace boost;
void something()
{
}
int main ()
{
thread rawr = thread(something);
return 0;
}
编译日志:
.../Dev-Cpp/lib/libboost_thread.a(thread.o)(.text+0x3526):thread.cpp: undefined reference to `gettimeofday'
.../Dev-Cpp/lib/libboost_thread.a(thread.o)(.text+0x3551):thread.cpp: undefined reference to `_gmtime32'
.../Dev-Cpp/lib/libboost_thread.a(thread.o)(.text+0x393e):thread.cpp: undefined reference to `gettimeofday'
.../Dev-Cpp/lib/libboost_thread.a(thread.o)(.text+0x3966):thread.cpp: undefined reference to `_gmtime32'
.../Dev-Cpp/lib/libboost_thread.a(thread.o)(.text+0x3e9e):thread.cpp: undefined reference to `gettimeofday'
.../Dev-Cpp/lib/libboost_thread.a(thread.o)(.text+0x3ec9):thread.cpp: undefined reference to `_gmtime32'
.../Dev-Cpp/lib/libboost_thread.a(thread.o)(.text+0x533a):thread.cpp: undefined reference to `gettimeofday'
.../Dev-Cpp/lib/libboost_thread.a(thread.o)(.text+0x5365):thread.cpp: undefined reference to `_gmtime32'
.../Dev-Cpp/lib/libboost_thread.a(thread.o)(.text+0x57f0):thread.cpp: undefined reference to `gettimeofday'
.../Dev-Cpp/lib/libboost_thread.a(thread.o)(.text+0x581b):thread.cpp: undefined reference to `_gmtime32'
.../Dev-Cpp/lib/libboost_thread.a(thread.o)(.text$_ZN5boost9date_time6c_time6gmtimeEPKlP2tm[boost::date_time::c_time::gmtime(long const*, tm*)]+0x44):thread.cpp: undefined reference to `_gmtime32'
collect2: ld returned 1 exit status
make.exe: *** [project.exe] Error 1
Execution terminated
我在项目选项中链接了 libboost_thread.a 但我想我需要更多东西?(到底是什么?)请帮我解决这个问题。提前致谢 :)
I'm using Dev C++ on Windows XP and I downloaded Boost package v 1.46.0 and installed it. I want to use it to make threads but I can't seem to compile even the simplest code.
My code:
#include <boost/thread.hpp>
using namespace boost;
void something()
{
}
int main ()
{
thread rawr = thread(something);
return 0;
}
Compile log:
.../Dev-Cpp/lib/libboost_thread.a(thread.o)(.text+0x3526):thread.cpp: undefined reference to `gettimeofday'
.../Dev-Cpp/lib/libboost_thread.a(thread.o)(.text+0x3551):thread.cpp: undefined reference to `_gmtime32'
.../Dev-Cpp/lib/libboost_thread.a(thread.o)(.text+0x393e):thread.cpp: undefined reference to `gettimeofday'
.../Dev-Cpp/lib/libboost_thread.a(thread.o)(.text+0x3966):thread.cpp: undefined reference to `_gmtime32'
.../Dev-Cpp/lib/libboost_thread.a(thread.o)(.text+0x3e9e):thread.cpp: undefined reference to `gettimeofday'
.../Dev-Cpp/lib/libboost_thread.a(thread.o)(.text+0x3ec9):thread.cpp: undefined reference to `_gmtime32'
.../Dev-Cpp/lib/libboost_thread.a(thread.o)(.text+0x533a):thread.cpp: undefined reference to `gettimeofday'
.../Dev-Cpp/lib/libboost_thread.a(thread.o)(.text+0x5365):thread.cpp: undefined reference to `_gmtime32'
.../Dev-Cpp/lib/libboost_thread.a(thread.o)(.text+0x57f0):thread.cpp: undefined reference to `gettimeofday'
.../Dev-Cpp/lib/libboost_thread.a(thread.o)(.text+0x581b):thread.cpp: undefined reference to `_gmtime32'
.../Dev-Cpp/lib/libboost_thread.a(thread.o)(.text$_ZN5boost9date_time6c_time6gmtimeEPKlP2tm[boost::date_time::c_time::gmtime(long const*, tm*)]+0x44):thread.cpp: undefined reference to `_gmtime32'
collect2: ld returned 1 exit status
make.exe: *** [project.exe] Error 1
Execution terminated
I linked libboost_thread.a in project options but I guess I need something more?(What exactly?) Please help me fix this. Thanks in advance :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论