Undefined Reference to WinMain@16 When Compiling SDL_ttf?

给你一囗甜甜゛ 提交于 2019-12-11 08:24:42

问题


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.

  1. SDL_ttf
  2. showfont
  3. 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.



回答1:


The problem seems similar to something you encounter in MSVS, in that you have to declare the main function as:

int _tmain(int argc, _TCHAR* argv[])

or

int wmain(int argc, _TCHAR* argv[])

The environment tries to call this function and not main() and since you haven't implemented it, the linking error occurs.



来源:https://stackoverflow.com/questions/9037622/undefined-reference-to-winmain16-when-compiling-sdl-ttf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!