没有这样的文件或目录,而本地构建工作正常
No such file or directory while local build works fine
在更改为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: gladglad.h: No such file or directory
#include <gladglad.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
这是我的CMakeList.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?(编译器理解它,它是一个不可移植的扩展。
gcc 支持在 Windows 上的包含路径中使用反斜杠作为扩展
#include <gladglad.h>
这在 linux 下不受支持,您应该只在包含路径中使用正斜杠/
#include <glad/glad.h>
相关文章:
- 从不同目录执行时"symbol lookup error:",否则从构建目录执行时按预期工作
- Visual Studio 2019:使用 vcvars64 从命令行构建C++.bat不再工作
- 所有Visual Studio安装程序崩溃,可视化构建工具也无法正常工作
- 构建对象数组是如何工作的?我被这个例子困住了
- 我的代码在构建时没有任何错误,但无法正常工作
- 没有这样的文件或目录,而本地构建工作正常
- 想法C++自动统一构建系统,它能工作吗
- 如何为IOCP构建工作线程逻辑
- Qt 4.8.4 从 Ubuntu 12.04 上的源代码构建,无法正常工作
- 错误:不是.exe已停止工作 - 尝试构建 LLVM 时
- Ctest/CDash工作流:部署夜间构建
- 用Xcode 3.2.6构建10.7 Lion应用程序-它们能工作吗
- 为什么需要构建boost来使下载的项目工作
- 在构建时工作,但在调试器中有问题
- QT 5.7 MSVC 2015静态构建不工作
- Android源代码构建#ifdefs如何在编译中工作
- Libpcap的例子不工作,但项目在eclipse中构建
- 使用ZeroMQ构建点对点工作负载调度器是否有帮助?
- 在Eclipse中设置c++构建工作目录
- LNK1104时使用完全重建,但增量构建工作visual studio 2012 express