编译 SDL_ttf 时未定义对 WinMain@16 的引用?
我正在尝试使用 MinGW 和 Code::Blocks 编译 SDL_ttf。我已将 MSVC 解决方案导入到 Code::Blocks 中,共有三个项目。
- SDL_ttf
- showfont
- glfont
在将 SDL 标头添加到路径并与 SDL.a
链接后,SDL_ttf
项目编译良好。现在,每当我尝试编译 glfont
或 showfont
时,我都会得到:
undefined reference to `WinMain@16`
来自 SDL 常见问题解答 据我所知,当您不这样做时,可能会出现此问题与 SDLmain.a
链接,因此我链接了它,但仍然收到错误。有什么建议吗?我完全迷路了。
I am trying to compile SDL_ttf with MinGW and Code::Blocks. I have imported the MSVC Solution to Code::Blocks, There were three projects.
- SDL_ttf
- showfont
- glfont
the SDL_ttf
project compiled fine after adding the SDL headers to the path and linking with SDL.a
. Now whenever I try to compile glfont
or showfont
I get:
undefined reference to `WinMain@16`
From the SDL FAQ I understood that this problem may occur when you do not link with SDLmain.a
, so I linked with it, but I'm still getting the error. Any suggestions? I'm completely lost.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该问题似乎与您在 MSVS 中遇到的问题类似,因为您必须将 main 函数声明为:
或
环境尝试调用此函数而不是
main()
并且因为您尚未实现它,发生链接错误。The problem seems similar to something you encounter in MSVS, in that you have to declare the main function as:
or
The environment tries to call this function and not
main()
and since you haven't implemented it, the linking error occurs.