【发布时间】:2013-05-30 08:18:19
【问题描述】:
我认为 Ubuntu 和 OS X 将具有类似的界面来使用 SDL 编译 C/C++ 程序,但我没有尝试,或者在 Google 上找到的似乎都不起作用。
我找到了 Xcode 的解决方案,但我没有使用 Xcode。我正在使用 Sublime Text 2 编写程序并通过命令行进行编译,因为我更喜欢它并且以这种方式工作得更快。
长话短说,每次尝试我都会收到一系列错误,到目前为止,我已将SDL.framework 复制到我的/Library/Frameworks 目录中。
这是我最接近实际编译的:
[ 674 / 174 / 0 ] $ compcpsdl
Undefined symbols for architecture x86_64:
"_SDL_main", referenced from:
-[SDLMain applicationDidFinishLaunching:] in ccYYA0Ea.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
终端命令(即 compcpsdl)
g++ -I/Library/Frameworks/SDL.framework/Headers main.cpp SDLmain.m -framework SDL -framework Cocoa
具有以下项目结构:
Project-Directory/
--- main.cpp
--- SDLMain.m
--- SDLMain.h
最后,以下源代码:
#include <iostream>
#include <SDL/SDL.h>
using namespace std;
int main ()
{
cout << "Hello World!";
return 0;
}
看来我做的一切都是正确的,但似乎没有任何工作。
各位有什么想法吗?
【问题讨论】:
-
Note sure if this is relevant? 它会匹配您的链接错误。
-
@BoBTFish 非常感谢。它没有解决我的问题,但其他答案之一满足了我的辅助查询。
标签: c++ macos compilation compiler-errors sdl