QT 和 Boost:找不到 -llibboost_filesystem
QT and Boost : Cannot find -llibboost_filesystem
我使用(但我不能使用其他版本的 Qt):
- QT Creator 2.4.1 和 QT 4.8.4(带有 Mingw 编译器)
- 提升 1.52
建立提升:
- 我首先将 "C:/Qt/qtcreator-2.4.1/mingw/bin" 添加到我的 PATH 变量
- 然后打开命令提示符
- 去了"C:/boost_1_52"
- 键入 "bootstrap.bat mingw"
- 然后"b2 toolset=gcc build-type=complete stage"(这花了很长时间(大约2h))
我想将 QT creator 与 boost 库一起使用,但遇到了困难。
我的项目很简单,只有基本的QT代码:
QCoreApplication a(argc, argv)
return a.exec()
我刚刚添加了一些内容:
#include <boost/thread.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <boost/asio.hpp>
#include <boost/timer.hpp>
在我的 .pro 文件中,我添加了:
DEFINES += BOOST_ALL_USE_LIB
INCLUDEPATH += C:/boost_1_52
LIBS += -LC:/boost_1_52/stage/lib \
-lboost_system-mgw48-mt-1_52 \
-lboost_thread-mgw48-mt-1-52 \
-lboost_timer-mgw48-mt-1_52
#"libboost_system..." needs this library
LIBS += -LC:/windows_sdk/lib \
-lWS2_32
当我构建我的项目时,我有两种 'undefined reference to' :
其中一些带有 'thread',例如:
undefined reference to `boost::thread::thread()'
undefined reference to `boost::thread::joinable() const'
一些看起来像:
undefined reference to `boost::system::generic_category()'
undefined reference to `boost::system::system_category()'
提前感谢您的帮助。
试试这个。
LIBS += "-LC:/boost_1_57_0/libs/" \
问题已解决!
几周前,我安装了 MinGW 4.8.1 自带的 strawberry pearl
Qt Creator自带的MinGW是4.4.0
所以,在我的环境变量 PATH
中,我有 "C:\Strawberry\c\bin" 和 "C:\Qt\Qt creator\mingw\bin"
当我构建 boost 时,它一定使用了它能找到的最新版本的 MinGW,也就是 Strawberry 自带的那个。
这就是导致我所有问题的原因,我用 Qt creator 的 MinGW 重建了 boost,一切正常!
我没有足够注意图书馆名称中的 "mg48"
我使用(但我不能使用其他版本的 Qt):
- QT Creator 2.4.1 和 QT 4.8.4(带有 Mingw 编译器)
- 提升 1.52
建立提升:
- 我首先将 "C:/Qt/qtcreator-2.4.1/mingw/bin" 添加到我的 PATH 变量
- 然后打开命令提示符
- 去了"C:/boost_1_52"
- 键入 "bootstrap.bat mingw"
- 然后"b2 toolset=gcc build-type=complete stage"(这花了很长时间(大约2h))
我想将 QT creator 与 boost 库一起使用,但遇到了困难。 我的项目很简单,只有基本的QT代码:
QCoreApplication a(argc, argv)
return a.exec()
我刚刚添加了一些内容:
#include <boost/thread.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <boost/asio.hpp>
#include <boost/timer.hpp>
在我的 .pro 文件中,我添加了:
DEFINES += BOOST_ALL_USE_LIB
INCLUDEPATH += C:/boost_1_52
LIBS += -LC:/boost_1_52/stage/lib \
-lboost_system-mgw48-mt-1_52 \
-lboost_thread-mgw48-mt-1-52 \
-lboost_timer-mgw48-mt-1_52
#"libboost_system..." needs this library
LIBS += -LC:/windows_sdk/lib \
-lWS2_32
当我构建我的项目时,我有两种 'undefined reference to' :
其中一些带有 'thread',例如:
undefined reference to `boost::thread::thread()' undefined reference to `boost::thread::joinable() const'
一些看起来像:
undefined reference to `boost::system::generic_category()' undefined reference to `boost::system::system_category()'
提前感谢您的帮助。
试试这个。
LIBS += "-LC:/boost_1_57_0/libs/" \
问题已解决!
几周前,我安装了 MinGW 4.8.1 自带的 strawberry pearl Qt Creator自带的MinGW是4.4.0
所以,在我的环境变量 PATH
中,我有 "C:\Strawberry\c\bin" 和 "C:\Qt\Qt creator\mingw\bin"
当我构建 boost 时,它一定使用了它能找到的最新版本的 MinGW,也就是 Strawberry 自带的那个。
这就是导致我所有问题的原因,我用 Qt creator 的 MinGW 重建了 boost,一切正常!
我没有足够注意图书馆名称中的 "mg48"