【问题标题】:CLion IDE (CMake): Project builds but no intelligence for external librariesCLion IDE (CMake):项目构建但没有外部库的智能
【发布时间】:2020-11-20 14:22:08
【问题描述】:

我已经实现了GLFW basic example

报告 GLFW 头文件未找到,因此 CLion IDE 报告错误并且不提供智能感知,但是项目可以正确编译和运行。

我已按照 documentation 中的指导添加了 GLFW 库(请参阅 CMakeLists.txt)。

项目正在 Ubuntu 20.04 上远程构建和运行。

ma​​in.cpp

#include <GLFW/glfw3.h>

int main(void)
{
    GLFWwindow* window;

    /* Initialize the library */
    if (!glfwInit())
        return -1;

    ...
}

CMakeLists.txt

project(untitled1)

set(CMAKE_CXX_STANDARD 14)
set(SOURCE_FILES main.cpp)


find_package(glfw3 3.3 REQUIRED)

add_executable(untitled1 ${SOURCE_FILES})
target_link_libraries(untitled1 glfw)

【问题讨论】:

  • 你在哪里target_include_directories GLFW 头目录? FindGLFW3.cmake 暴露了GLFW3_INCLUDE_DIRS GLFW3_LIBRARIES 变量。
  • 等等,你正在远程构建这个?您的本地系统不应该也安装 glfw3 以便 clion 看到它吗?

标签: c++ cmake clion glfw


【解决方案1】:

对于遇到此问题的任何人,请致电 Tools |与远程主机重新同步 -

【讨论】:

    猜你喜欢
    • 2019-01-10
    • 1970-01-01
    • 2018-03-26
    • 1970-01-01
    • 2015-06-12
    • 2019-07-31
    • 1970-01-01
    • 2023-03-28
    • 2022-01-07
    相关资源
    最近更新 更多