[英]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.所以我用 cmake 构建了一个
GLFW
程序,一切都很好,直到我构建它并make
我这个错误Undefined symbols for architecture arm64: "_glClear", referenced from: _main in main.cpp.o ld: symbol(s) not found for architecture arm64
,我尝试使用此命令CMAKE_LINK_LIBRARY_SUFFIX
而此link_directories
仍然无法正常工作,我不知道这里发生了什么。
Edit: Here are my CMakeLists编辑:这是我的 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.回答:所以你需要在 target_link_libraries 的 CMAKELISTS 中添加这一行:
"-framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo"
CMAKELISTS
target_link_libraries
可以使用"-framework OpenGL"
,但如果你使用所有解决方案你一些警告。 I don't know but if you don't see any warning I think I'm using vcpkg
incorrectly And this Question is SOLVED我不知道,但如果您没有看到任何警告,我认为我使用
vcpkg
不正确而且这个问题已解决
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.