В настоящее время я пытаюсь настроить проект OpenGL (ниже представлена моя файловая структура)
Код: Выделить всё
.vscode
tasks.json
include
glad
glad.h
GLFW
glfw3.h
glfw3native.h
KHR
khrplatform.h
lib
libglfw.a
src
config.h
glad.c
main.cpp
CMakeLists.txt
Код: Выделить всё
cmake_minimum_required(VERSION 3.12.0)
project(template VERSION 1.0.0)
cmake_policy(SET CMP0072 NEW)
set(CMAKE_CXX_STANDARD 20)
find_package(OpenGL REQUIRED)
add_executable(template
src/config.h
src/main.cpp
src/glad.c
)
target_include_directories(template
PRIVATE
include
lib
)
target_link_libraries(template
glfw3
OpenGL::GL
)
When I run my code, I run with the clang++ compiler and it gives me a linker error. Im just very confused on why it seems it works sometimes and other times doesnt, ive thought about switching IDE's as I dont have an issue linking libraries and directories on visual studio but I am on mac and have to switch as Visual Studio is being discontinued.
Источник: https://stackoverflow.com/questions/781 ... -in-vscode