正如标题中所述,我试图将 glew.h 添加到在VisualStudio2019(Windows10)上用CMake构建的项目中,这样做会在构建阶段 fatal error C1083: Cannot open include file: 'GL/glew.h': No such file or directory 中遇到一个错误。
glew.h
fatal error C1083: Cannot open include file: 'GL/glew.h': No such file or directory
我把它包括在 engine.hpp 中,作为 #include <GL/glew.h>
engine.hpp
#include <GL/glew.h>
CMakeLists.txt
cmake_minimum_required (VERSION 3.8) set(PROJECT GUI_Engine) add_executable (${PROJECT} "./src/driver/main.cpp") set(HEADER_FILES ./src/include) set(DEC_FILES ./src/lib) set(PKGPATH C:/dev/vcpkg/packages) add_library(engine ${DEC_FILES}/engine.cpp ${HEADER_FILES}/engine.hpp) list(APPEND CMAKE_PREFIX_PATH ${PKGPATH}/sdl2_x64-windows) find_package(SDL2 CONFIG REQUIRED)