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.
この問題を解決するにはどうすればよいですか?