gpt4 book ai didi

c++ - 本地构建工作正常时没有这样的文件或目录

转载 作者:行者123 更新时间:2023-11-30 01:05:00 24 4
gpt4 key购买 nike

在切换到 CMake 和 Travis CI 构建环境时,我在 Travis CI 上启用了编译。即使 CMake 项目在我的电脑上编译正确,Travis 也以 2 退出:

In file included from /home/travis/build/Codestones/Proton/source/application.cpp:1:0:
/home/travis/build/Codestones/Proton/source/application.h:3:23: fatal error: glad\glad.h: No such file or directory
#include <glad\glad.h>
^
compilation terminated.
make[2]: *** [CMakeFiles/Proton.dir/source/application.cpp.o] Error 1
make[1]: *** [CMakeFiles/Proton.dir/all] Error 2
make: *** [all] Error 2

这是我的 CMakeLists.txt:

cmake_minimum_required(VERSION 3.1)

project(Proton)

set(CMAKE_CXX_STANDARD 11)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

set(SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/source")
set(LIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dependencies")

# Executable definition and properties
file(GLOB SOURCES
"${SRC_DIR}/*.h"
"${SRC_DIR}/*.cpp"
)
add_executable(Proton "${SOURCES}")

# GLFW
set(GLFW_DIR "${LIB_DIR}/glfw")
set(GLFW_BUILD_EXAMPLES OFF CACHE INTERNAL "Build the GLFW example programs")
set(GLFW_BUILD_TESTS OFF CACHE INTERNAL "Build the GLFW test programs")
set(GLFW_BUILD_DOCS OFF CACHE INTERNAL "Build the GLFW documentation")
set(GLFW_INSTALL OFF CACHE INTERNAL "Generate installation target")
add_subdirectory("${GLFW_DIR}")
target_link_libraries(${PROJECT_NAME} "glfw" "${GLFW_LIBRARIES}")
target_include_directories(${PROJECT_NAME} PRIVATE "${GLFW_DIR}/include")
target_compile_definitions(${PROJECT_NAME} PRIVATE "GLFW_INCLUDE_NONE")

# GLAD
set(GLAD_DIR "${LIB_DIR}/glad")
add_subdirectory("${GLAD_DIR}")
target_link_libraries(${PROJECT_NAME} "glad" "${GLAD_LIBRARIES}")
target_include_directories(${PROJECT_NAME} PRIVATE "${PROJECT_BINARY_DIR}/dependencies/glad/include")

我认为这意味着 glad.h 丢失或链接不正确,但为什么它可以在我的电脑上正常构建和运行?

最佳答案

\ 不能用作#include 指令中的路径分隔符,请使用/。如果您的本地(Windows?)编译器理解它,那么它就是一个不可移植的扩展。

关于c++ - 本地构建工作正常时没有这样的文件或目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49101007/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com