简体   繁体   中英

Undefined symbols for architecture arm64: "_glClear", referenced from: _main in main.cpp.o arm64 GLFW3

So i was build a GLFW program with cmake Everthing went fine Until i build it and make give me this error Undefined symbols for architecture arm64: "_glClear", referenced from: _main in main.cpp.o ld: symbol(s) not found for architecture arm64 I try with this command CMAKE_LINK_LIBRARY_SUFFIX And this link_directories Still not working i have no idea what's going on here.

Edit: Here are my CMakeLists

cmake_minimum_required(VERSION 3.20.0)

project(TESTING)

add_executable(${PROJECT_NAME} "main.cpp")

set(CMAKE_LIBRARY_PATH "~/DEV/vcpkg/installed/arm64-osx")
set(CMAKE_TOOLCHAIN_FILE "~/DEV/vcpkg/scripts/buildsystems/vcpkg.cmake")
link_directories(~/DEV/vcpkg/installed/arm64-osx/lib)

find_package(glfw3 CONFIG REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE glfw)

ANSWER: So you need to add this line: "-framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo" in the CMAKELISTS on target_link_libraries Or you can use "-framework OpenGL" but if you use all the solution up there it will give you some warning. I don't know but if you don't see any warning I think I'm using vcpkg incorrectly And this Question is SOLVED

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM