gpt4 book ai didi

c++ - 来自 Boost : cannot find the libraries to link with 的链接器错误

转载 作者:行者123 更新时间:2023-11-28 07:20:40 25 4
gpt4 key购买 nike

我有这个与 Boost 相关的链接器错误:

error: cannot find -lboost_program_options-mgw44-mt-1_54
error: collect2: ld returned 1 exit status

这是Qt pro文件中与Boost相关的部分:

BOOST_VERS = 1_54
COMPILER = mgw44

INCLUDEPATH += $$BOOST_ROOT/boost
QMAKE_LIBDIR += $$BOOST_ROOT/stage/lib

LIBS += -lboost_program_options-$$COMPILER-mt-$$BOOST_VERS
LIBS += -lboost_thread-$$COMPILER-mt-$$BOOST_VERS
LIBS += -lboost_system-$$COMPILER-mt-$$BOOST_VERS

BOOST_ROOT 是设置为 C:\Boost_1_54_0 的环境变量。

由于 Boost 似乎已正确安装(库在那里),我做错了什么?

系统:
- Windows 7
- MinGW 4.4
- boost 1.54.0
- qmake/Qt Creator

最佳答案

QMAKE_LIBDIR

This variable contains the location of all known library directories. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.

请尝试这样做:

win32-g++* {
LIBS += $${BOOST_ROOT}/stage/lib/libboost_system-$${COMPILER}-mt-$${BOOST_VERS}.a
PRE_TARGETDEPS += $${BOOST_ROOT}/stage/lib/libboost_system-$${COMPILER}-mt-$${BOOST_VERS}.a
}

linux-g++* {
LIBS += -L$${BOOST_ROOT}/stage/lib -lboost_system-$${COMPILER}-mt-$${BOOST_VERS}
PRE_TARGETDEPS += $${BOOST_ROOT}/stage/lib/libboost_system-$${COMPILER}-mt-$${BOOST_VERS}.a
}

关于c++ - 来自 Boost : cannot find the libraries to link with 的链接器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19516399/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com