undefined reference to `glClearColor' bei Build?



  • Error:

    main.cpp:(.text+0x86): undefined reference to `glClear'
    /usr/bin/ld: main.cpp:(.text+0xa5): undefined reference to `glClearColor'
    collect2: error: ld returned 1 exit status
    make[2]: *** [CMakeFiles/PhysicsEngine.dir/build.make:100: PhysicsEngine] Error 1
    make[1]: *** [CMakeFiles/Makefile2:117: CMakeFiles/PhysicsEngine.dir/all] Error 2
    make: *** [Makefile:136: all] Error 2
    

    CMakeLists.txt

    # CMake config
    cmake_minimum_required(VERSION 3.2)
    
    # Project
    project(PhysicsEngine VERSION 1.0.0)
    
    # C++ standard
    set(CMAKE_CXX_STANDARD 17)
    set(CMAKE_CXX_STANDARD_REQUIRED ON)
    
    # Source files
    add_executable(${PROJECT_NAME} src/main.cpp)
    
    # OpenGL
    find_package(OpenGL REQUIRED)
    
    # Subdirectories
    add_subdirectory(lib/glfw)
    
    # Include directories
    target_include_directories(${PROJECT_NAME}
        PUBLIC lib/glfw/include
    )
    
    # Link directories
    target_link_directories(${PROJECT_NAME}
        PRIVATE lib/glfw/src
    )
    
    # Link libraries
    target_link_libraries(${PROJECT_NAME}
        OpenGL::GL
        glfw
    )
    


  • Glaskugel hat heute auch einen Error.


Anmelden zum Antworten