为什么框架中的标题无法访问?

时间:2017-06-26 17:05:11

标签: c++ macos cmake clion

我正在尝试使用CLion将我的C ++应用程序移植到OSX。它使用SDL2和SDL2_Mixer。

我通过在我的CMakeLists.txt中使用Find.cmake来包含它们

find_package(SDL2 REQUIRED)

if (${SDL2_FOUND})
    message("SLD2 found")
    message(${SDL2_INCLUDE_DIR})
endif()

find_package(SDL2_mixer REQUIRED)

if (${SDL2_mixer_FOUND})
    message("SDL2_Mixer found")
    message(${SDL2_MIXER_INCLUDE_DIRS})
endif()

include_directories(${SDL2_INCLUDE_DIR} ${SDL2_MIXER_INCLUDE_DIRS})

这在我的CMake日志中给出了这个输出

SLD2 found
/Users/saurbaum/Library/Frameworks/SDL2.framework/Headers
SDL2_Mixer found
/Users/saurbaum/Library/Frameworks/SDL2_mixer.framework/Headers

所有这些似乎都正常工作。当我尝试包含SDL及其扩展的标头时,它无法编译。

例如

 fatal error: 'SDL_mixer.h' file not found #include <SDL_mixer.h>

我试过

#include "SDL2/SDL_mixer.h"
#include "SDL_mixer.h"

以防这个编译器存在一些差异。

#include <SDL2/SDL_mixer.h>
#include <SDL_mixer.h>

相同的代码在Windows和Linux上运行良好,只是OSX让我头疼。

0 个答案:

没有答案