SDL 找不到我的主要功能
SDL can't find my main function
我用SDL框架设置了我的应用程序,它可以正常工作,没有任何错误。但当我尝试启动程序时,它会立即终止,甚至在进入我的简单主方法之前。这里的代码:
#include "CApp.h"
#include <iostream>
int main(int argc, char* argv[]) {
std::cout << "Hello";
return 0;
}
我知道SDL在SDLMain.m中实现了自己的主要功能,并手动启动了我的主要功能。我想我在STMain.m中找到了执行我的主要功能的代码(第222ff行):
/* Create SDLMain and make it the app delegate */
sdlMain = [[SDLMain alloc] init];
[NSApp setDelegate:sdlMain];
/* Start the main event loop */
[NSApp run];
当我在[NSApp run]
上设置断点并向前迈出一步时,程序终止。
#define
的main
到SDL_main
,以便透明地使用其自己的main
实现。由于您还没有包含任何SDL标头,因此您的作用域中没有该宏。只需将main
重命名为SDL_main
或包含一个SDL头(如SDL.h
)即可。
相关文章:
- 询问在设计我的手臂模拟器功能表示格式1
- 反向功能超出了我的 cpp 程序的范围
- 为什么我的功能在使用 goto 时会给我带来"expected primary-expression before '}' token"?
- 为什么我的打印功能不起作用?链表
- 为什么我的显示功能会终止程序?
- "configure"脚本如何检测我的系统是否支持某些头文件或 cpp 功能?
- 如何使我的 cmake 项目所需的某些 c++ 功能
- 为什么我的删除功能总是出现分段错误
- 如何改进我的"String"对象比较功能
- 使用链表.为什么我的插入功能不起作用?
- 我的显示功能有问题
- 为什么我的打印功能之一删除节点
- 为什么我的删除功能中存在错误
- 如果我使用此功能,我的控制台崩溃
- 如何将此功能连接到我的连接按钮?
- 我的模板功能具有通用引用不起作用
- 我的班级功能的分段故障
- 我的朋友功能无法访问私人变量
- C //尝试重写一个工作代码以包括我的功能
- 尽管我的功能和cout语句的放置错误,但我的程序为什么会起作用