sdl_ttf iOS错误的入口点

时间:2014-10-30 10:31:42

标签: c++ ios xcode entry-point sdl-ttf

我一直在尝试使用SDL for iOS,它一直顺利进行,直到我添加了sdl_ttf。我得到的唯一输出是

apinames 0.1: extract FreeType API names from header files

this program is used to extract the list of public FreeType API
functions. It receives the list of header files as argument and
generates a sorted list of unique identifiers

usage: apinames header1 [options] [header2 ...]

options:   -      : parse the content of stdin, ignore arguments
           -v     : verbose mode, output sent to standard error
           -oFILE : write output to FILE instead of standard output
           -dNAME : indicate DLL file name, 'freetype.dll' by default
           -w     : output .DEF file for Visual C++ and Mingw
           -wB    : output .DEF file for Borland C++
           -wW    : output Watcom Linker Response File

通过Google搜索,我发现了与我有同样问题的人提出的问题:SDL2_ttf won't run on ios

似乎正在运行另一个main(一个内部sdl_ttf)并正在生成输出。

  1. 我提到的帖子上的评论者说"我猜你在工具目录中的项目中包含了apinames.c,主要是运行的内容"。什么是工具目录?我该如何解决这个问题?

  2. 如何将Xcode项目的入口点更改为main.cpp?

  3. 感谢您的任何建议。

2 个答案:

答案 0 :(得分:0)

我必须实际看到你的项目回答#1(你看过你的&#34;编译的源和#34;对于apinames.c吗?),但如果我回答#2,这可能是无关紧要的。< / p>

如果您查看SDL_main.h源文件,您将看到:

  

#elif defined(__ IPHONEOS__)/ *在iOS上,SDL提供了一个主要功能,可以创建应用程序委托并启动iOS应用程序   运行循环。

     

有关详细信息,请参阅src / video / uikit / SDL_uikitappdelegate.m。 * /

     

#define SDL_MAIN_NEEDED

结果证明你可以继承SDLUIKitDelegate并强制SDL通过创建这样的类来实例化它:

@implementation SDLUIKitDelegate (MyDelegate)
+ (NSString *)getAppDelegateClassName
{
    //override this SDL method so an instance of our subclass is used
    return @"MyDelegateClass";
}
@end

您需要查看SDLUIKitDelegate的来源,这样您就可以了解自己所处理的内容,但我的应用只会覆盖application:didFinishLaunchingWithOptions:这样的内容:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    AddLogger(createAppleLogger());
    [self setupWrapper];

    // Notice how we call super implementation so SDL can finish its setup
    return [super application:application didFinishLaunchingWithOptions:launchOptions];
}

这是否足够接近您的切入点?或者你真的需要main()吗?这意味着必须自己完成所有SDL设置(可以在SDL修订版之间进行更改)。

另请注意,您的main()应该重新定义为SDL_main,并且应该在某个时间点(如果我的记忆服务的话)被调用。

答案 1 :(得分:0)

拖动以重新排序框架内的#34; Link Binary With Libraries&#34;在&#34; Build Phases&#34;下的xcode构建目标中找到。确保SDL2.framework(或您正在使用的任何内容)高于SDL2_image.framework。