【问题标题】:How to use boost with QtCreator如何在 QtCreator 中使用 boost
【发布时间】:2021-11-23 03:01:57
【问题描述】:

我在 QtCreator 中有一个正在运行的 C++ 项目,并且想使用一些 boost 的特性。我从https://www.boost.org/doc/libs/1_55_0/more/getting_started/windows.html下载了boost zip文件

但我想我必须做一些步骤才能被 QtCreator 拾取,目前,如果我在文件中键入#include ,它会显示file not found 错误。应该采取哪些步骤来完成这项工作?

【问题讨论】:

标签: c++ boost windows-10 qt-creator


【解决方案1】:

您必须在编译时提供头文件的路径。 如果您将 Qt 与 qmake 一起使用,请在 .pro 文件中添加这样的路径

HEADERS += \
{path to the header}

SOURCES += \
{path to the source file}

如果您将 Qt 与 CMake 一起使用,您可以轻松地将这样的头文件添加到您的 CMakeList.txt 文件中

include_directories(${YOUR_DIRECTORY})

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-03-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-30
    相关资源
    最近更新 更多