<分区>
我有一个非常简单的 C 程序,它是 taken from the SDL documentation :
#include <stdlib.h>
#include "SDL.h"
int main() {
if (SDL_Init(SDL_INIT_AUDIO|SDL_INIT_VIDEO) < 0) {
return EXIT_FAILURE;
}
atexit(SDL_Quit);
return EXIT_SUCCESS;
}
我正在使用 sdl-config --cflags --libs
为 clang 提供参数。它能够链接到 SDL header ,但无法链接到 SDL 库:
/tmp/example-f2Tgg6.o: In function `main':
example.c:7: undefined reference to `SDL_Init'
example.c:8: undefined reference to `SDL_Quit'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我尝试用 gcc 编译并遇到同样的问题,所以我觉得我错过了一些明显的东西。我正在运行 xubuntu 11.10 以防万一。