我正在为 SDL 开发一个简单的包装器,以用作一种游戏引擎。目前我有一个简单的临时主函数,如下所示:
#include <iostream>
int main(int argc, char * argv[])
{
std::cout << "Still in development!\n";
return 0;
}
除了包装器的一些简单功能:
#include "SDL.h"
namespace snowshoe
{
void initialize()
{
SDL_Init(SDL_INIT_EVERYTHING);
}
void release()
{
SDL_Quit();
}
void update(SDL_Surface * screen)
{
SDL_Flip(screen);
}
}
但是当我尝试编译这两个时,我得到以下错误:
Undefined symbols for architecture x86_64:
"_SDL_Flip", referenced from:
snowshoe::update(SDL_Surface*) in snowshoe-iru.o
"_SDL_Init", referenced from:
snowshoe::initialize() in snowshoe-iru.o
"_SDL_Quit", referenced from:
snowshoe::release() in snowshoe-iru.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
在有人问之前,我已经包含了我需要的所有标志:
`sdl-config --cflags` -lSDL
有任何想法吗?我正在运行 OSX Mountain Lion 并从命令行(不是 Xcode)编译。