CMake找不到我指定的包含文件
CMake not finding include file I specified
我正试图使用CMake来调试我正在处理的JUCE失真项目,但我无法获得CMakeLists.txt文件。找到头文件JuceHeader.h
,以便它可以构建和调试该项目。
文件结构如下:
distort (CMakeLists located here)
|
|_______Source
| |
| |________PluginEditor.cpp and .h, PluginProcessor.cpp and .h
|
|_______JuceLibraryCode
|
|________JuceHeader.h (and more)
以及完整的txt文件:
cmake_minimum_required(VERSION 3.0.0)
project(Distort VERSION 0.1.0)
include(CTest)
enable_testing()
set(HEADER_FILES /home/wolf/vst/distort/JuceLibraryCode)
set(SOURCES Source/PluginProcessor.cpp Source/PluginEditor.cpp ${HEADER_FILES}/JuceHeader.h)
add_executable(Distort ${SOURCES})
target_include_directories(Distort PRIVATE home/wolf/vst/distort/JuceLibraryCode/)
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
它给出了一个错误,说它找不到JuceHeader.h
最后,错误输出:
[build] /home/wolf/vst/distort/Source/PluginProcessor.h:11:10: fatal error: 'JuceHeader.h' file not found
[build] #include <JuceHeader.h>
[build] ^~~~~~~~~~~~~~
[build] In file included from /home/wolf/vst/distort/Source/PluginEditor.cpp:9:
[build] /home/wolf/vst/distort/Source/PluginProcessor.h:11:10: fatal error: 'JuceHeader.h' file not found
[build] #include <JuceHeader.h>
如有任何帮助,我们将不胜感激!:(
我认为home/wolf/vst/distort/JuceLibraryCode/
应该是一个绝对路径,但给出了相对路径。但绝对路径并不是解决方案。
target_include_directories(Distort PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/JuceLibraryCode)
或者就像下面的一样
target_include_directories(Distort PRIVATE JuceLibraryCode)
对于一个相对较新的cmake版本,以下内容应该有效:
file(GLOB headers ${CMAKE_SOURCE_DIR}/JuceLibraryCode)
...
target_include_directories(Distort PRIVATE ${headers})
相关文章:
- vcruntime.h 从 Windows 包含文件夹中丢失?
- 禁止显示有关包含文件中 #pragma 包的警告
- 无法打开包含文件:在 vs2017 上'QtWidgets/qtwidgetsglobal.h'
- 包含文件 <sched_yield.h>在我的 RHEL 5 上找不到
- 尝试使用 MSVC 从源代码构建 qt 创建器:无法打开包含文件:"stddef.h":没有这样的文件或目录
- 无法打开包含文件'Graphics.hpp'没有这样的文件或目录,Visual Studio的其他包含不起作用
- 为什么 C++ 编译器在"c:program filesgnu emacsinclude"中查找包含文件?
- 包含文件中的 Typdef "未在此范围内声明"
- 错误: C1083: 无法打开包含文件:"boost/asio.hpp": 没有此类文件或目录
- SFML c ++ 当包含文件内游戏中发生事件时,如何使用铃声函数为我的游戏创建声音类?
- 在Windows上设置CMake和vcpkg时出错"无法打开包含文件"
- 致命错误 C1083:无法打开包含文件:"GL/glew.h":没有此类文件或目录
- Qt自动生成的.rc文件无法打开包含文件'windows.h'
- Visual Studio 停止识别任何包含文件
- 无法打开包含文件:"签证.h"
- 如何检查每个头文件是否包含必需的包含文件?
- Protobuf:无法在 message.pb.h 文件中打开包含文件 common.h
- extern 关键字在包含文件头文件C++
- 错误:无法打开包含文件:"MQTTAsync.h":没有此类文件或目录
- #include "date.h" 创建错误 E1696 无法打开源文件"date.h",也无法打开包含文件:没有这样的文件或目录