我正在使用 CLion 编写一个 Cmake 项目。这是目录的树视图(文件被忽略),其中 lemon-1.3-1 是第三方库。
├── cmake-build-debug
│ ├── CMakeFiles
│ │ ├── 3.15.3
│ │ │ ├── CompilerIdC
│ │ │ │ └── tmp
│ │ │ └── CompilerIdCXX
│ │ │ └── tmp
│ │ ├── CheckTypeSize
│ │ ├── CMakeTmp
│ │ ├── graph_partition_essay.dir
│ │ └── Progress
│ └── lemon-1.3.1
│ ├── cmake
│ ├── CMakeFiles
│ │ ├── check.dir
│ │ └── dist.dir
│ └── lemon
│ └── CMakeFiles
│ └── lemon.dir
│ └── bits
└── lemon-1.3.1
├── cmake
│ └── nsis
├── contrib
├── demo
├── doc
│ ├── html
│ │ └── search
│ └── images
├── lemon
│ ├── bits
│ └── concepts
├── scripts
├── test
└── tools
我还写了以下内容CMakeLists.txt
。使用此文件,自动代码完成可以正常工作。
cmake_minimum_required(VERSION 3.15)
project(graph_partition_essay)
set (LEMON_INCLUDE_PATH ${CMAKE_SOURCE_DIR}/lemon-1.3.1)
add_subdirectory(lemon-1.3.1)
add_executable(graph_partition_essay main.cpp)
和main.cpp
#include <iostream>
#include "lemon-1.3.1/lemon/list_graph.h"
using namespace lemon;
int main() {
ListDigraph g;
std::cout << "Hello, World!" << std::endl;
return 0;
}
但是当我运行该main
函数时,我收到以下错误消息。
In file included from F:\xxx\graph_partition_essay\main.cpp:2:
F:\xxx\graph_partition_essay\lemon-1.3.1/lemon/list_graph.h:26:10: fatal error: lemon/core.h: No such file or directory
26 | #include <lemon/core.h>
| ^~~~~~~~~~~~~~
compilation terminated.
我该如何解决这个问题?