繁体   English   中英

sdl_ttf iOS错误的入口点

[英]sdl_ttf iOS wrong entry point

我一直在尝试iOS的SDL,并且一直进行得很顺利,直到我将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

谷歌搜索后,我从一个与我有相同问题的人那里发现了一个SO问题: SDL2_ttf无法在ios上运行

似乎正在运行其他主程序(sdl_ttf中的一个主程序)并正在生成输出。

  1. 我提到的帖子的评论者说:“我想您可能会在tools目录中将apinames.c包含在项目中,而主要的是正在运行的内容。” 什么是工具目录? 我该如何解决?

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

感谢您的任何建议。

我将不得不实际看到您的项目来回答#1(您是否在看apinames.c的“已编译源代码”?),但是如果我回答#2,也许那将是不相关的。

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

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

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

#定义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并且应该在某个时候被调用(如果我的内存SDL_main话)。

拖动以在xcode构建目标的“构建阶段”下的“链接二进制文件与库”中对框架进行重新排序。 确保SDL2.framework(或您使用的任何文件)在SDL2_image.framework之上。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM