gpt4 book ai didi

c++ - 体系结构 x86_64 "_SDL_Init"的 undefined symbol

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:19:03 25 4
gpt4 key购买 nike

每次我尝试编译一个使用 SDL 的程序时,它都会给我一个

"/Applications/Xcode.app/Contents/Developer/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
"/Applications/Xcode.app/Contents/Developer/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/GNU-MacOSX/testProgram
mkdir -p dist/Debug/GNU-MacOSX
g++ -o dist/Debug/GNU-MacOSX/testProgram build/Debug/GNU-MacOSX/Window.o build/Debug/GNU-MacOSX/main.o -L/Library/Frameworks/SDL.framework -L/Library/Frameworks/SDL2.framework
Undefined symbols for architecture x86_64:
"_SDL_Init", referenced from:
Window::startWindow() in Window.o
"_SDL_Quit", referenced from:
Window::exitWindow(bool) in Window.o
"_SDL_SetVideoMode", referenced from:
Window::startWindow() in Window.o
"_main", referenced from:
implicit entry/start for main executable
(maybe you meant: _SDL_main)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [dist/Debug/GNU-MacOSX/testProgramError 1
make[1]: *** [.build-conf] Error 2

我在 mac-OSX 上使用 netbeans(不是 Xcode,因为你不能制作跨平台应用程序)。

最佳答案

-lSDL链接SDL库

或者尝试 `sdl-config -- cflags --libs`,至少,它类似于 SDL2(除了使用 sdl2-config)。

关于c++ - 体系结构 x86_64 "_SDL_Init"的 undefined symbol ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29213708/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com