开始定义宏 SDL_MAIN_USE_CALLBACKS 就是使用SDL_main.h头文件方法,使用SDL_main.h头文件之后就不能使用 int main(int argc,char **argv)函数了,只能自己定义使用这四个函数。需要安装SDL3才能使用这些函数,我在SDL2 的SDL_main.h中没有发现这四个函数 为什么不能自己定义main作为程序的开始,而是使用这四个...
当你遇到“undefined reference to sdl_main'”错误时,通常是因为链接器未能找到SDL库中的SDL_main`函数。以下是一些可能的解决步骤: 确定错误原因: 这个错误通常表明你的项目在链接阶段未能找到SDL库中的SDL_main函数。这可能是因为SDL库没有被正确链接到你的项目中,或者链接器设置不正确。 检查链接器设置: 确...
这时,其实是main函数定义与sdl库里的不一样,比如: int main() 这时编译时,就会出现上面的出错。需要修改为这样: int main(int argc, char *argv[])
是由于主函数的main和sdl_main格式不一致, int main(int argc, char *agrv[]) {} 注意要带上参数,如果是WinMain要换成main 命令行参数在 调试->命令参数(注意要加引号) 命令行参数文件my.mp4要放在项目所在的目录
简介:无法解析的外部符号 _SDL_main”出错 1.首先检查自己的链接库是否正确,通常“无法解析的外部符号”都来自于链接库不正确、或者Release/Debug及平台设置与库版本不相同导致的 2.SDL下,使用#include请使用extern “C”描述,如下: extern "C"{#include <libavcodec/avcodec.h>#include <libavformat/avformat.h...
Every time I try to compile the .cpp file, I get a "raycaster_flat.cpp(228): error C4716: 'SDL_main' : must return a value" error. I can't figure out for the life of me what this means. Am I supposed to put a return in my .cpp or maybe in the SDL_main header? Help wo...
The SDL_main callback interface currently doesn't provide a way to pass program state, so the program has to store some of this state in static/global variables. This is cumbersome to do in e.g. the Rust programming language (in particul...
In file included from ***/Daemon/src/engine/client/cl_main.cpp:59: ***/Daemon/external_deps/macos-amd64-default_9/SDL2.framework/Headers/SDL.h:32:10: fatal error: 'SDL2/SDL_main.h' file not found #include <SDL2/SDL_main.h> ^~~~ 1 error generated. Contributor madebr commented...
无法解析的外部符号 _SDL_main”出错 SDL#include链接库main函数文章分类 1.首先检查自己的链接库是否正确,通常“无法解析的外部符号”都来自于链接库不正确、或者Release/Debug及平台设置与库版本不相同导致的 2.SDL下,使用#include请使用extern “C”描述,如下:...
这几天在使用SDL2,之前一直都没有错,直到上午把项目搬了个地方。结果一直出现 “error LNK2019: 无法解析的外部符号 _SDL_main,该符号在函数 _main 中被引用” 。 看了网上的方法都说是没有正确定义 main 函数 ,这是SDL2main.lib指定需要的函数。结果我把他定义在了"xx.h"这样的头文件中。