【发布时间】:2013-06-09 15:14:25
【问题描述】:
我学习SDL有一段时间了,现在决定试试SDL2,主要是试试它的硬件加速。但问题是,我根本无法编译它,而使用 SDL1.2 正确编译的相同代码。
示例代码为:
#include "SDL/SDL.h"
int main( int argc, char *args[] )
{
SDL_Init(SDL_INIT_EVERYTHING);
SDL_Quit();
return 0;
}
使用原始链接器设置:-lmingw32 -lSDLmain -lSDL
一切都会编译。
但只要我将#include "SDL/SDL.h" 更改为#include "SDL2/SDL.h"
并将链接器设置更改为
-lmingw32 -lSDL2main -lSDL2
我得到错误:
obj\Debug\main.o||In function `SDL_main':|
main.cpp|5|undefined reference to `SDL_Init'|
main.cpp|8|undefined reference to `SDL_Quit'|
libmingw32.a(main.o):main.c:(.text.startup+0xa7)||undefined reference to `WinMain@16'|
我在 C:/SDL-1.2.15 中安装了 SDL1.2,在 C 中安装了 SDL2: /SDL2
在搜索目录中,我添加了 SDL1.2 和 SDL2 Include 和 Lib 文件夹。
【问题讨论】:
标签: sdl codeblocks