Код:
Код: Выделить всё
#include
int main(int argc, char ** argv)
{
SDL_Init(SDL_INIT_VIDEO);
SDL_Window * screen = SDL_CreateWindow("My SDL Empty Window",
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, 0);
SDL_Delay(3000);
SDL_Quit();
return 0;
}
Вывод компилятора/компоновщика:
Код: Выделить всё
$ g++ -lSDL2 hellosdl.cpp
/usr/bin/ld: /tmp/foobarbaz.o: in function `main':
hellosdl.cpp:(.text+0x18): undefined reference to `SDL_Init'
/usr/bin/ld: hellosdl.cpp:(.text+0x3c): undefined reference to `SDL_CreateWindow'
/usr/bin/ld: hellosdl.cpp:(.text+0x4c): undefined reference to `SDL_Delay'
/usr/bin/ld: hellosdl.cpp:(.text+0x50): undefined reference to `SDL_Quit'
collect2: error: ld returned 1 exit status
Мои версии gcc и g++ — это g++ (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110, а моя архитектура (возвращаемая uname -a) — aarch64. Надеюсь, информация окажется полезной.
Подробнее здесь: https://stackoverflow.com/questions/798 ... m-ld-not-g
Мобильная версия