本文介绍了无法在MinGW上安装SDL,获得对WinMain @ 16的未定义引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在MinGW上安装SDL.

I'm trying to install SDL on MinGW.

我已经从此处下载了SDL( SDL2-devel-2.0.0-mingw.tar.gz 链接),然后将 SDL2-2.0.0/x86_64-w64-mingw32/{bin,include,lib} 的内容复制到在我的MinGW安装中匹配目录.

I've downloaded SDL from here (the SDL2-devel-2.0.0-mingw.tar.gz link), then copied the contents of SDL2-2.0.0/x86_64-w64-mingw32/{bin,include,lib} into the matching directories in my MinGW installation.

当我尝试使用 gcc test.c -lmingw32 -lSDL2main -lSDL2 -mwindows ,GCC编译包含 #include ‹SDL2/SDL.h› 的任何文件时抱怨对WinMain @ 16的未定义引用和对某些SDL函数的未定义引用.

When I try to compile any file that contains #include ‹SDL2/SDL.h› using gcc test.c -lmingw32 -lSDL2main -lSDL2 -mwindows, GCC complains about undefined reference to WinMain@16 and undefined reference to some SDL functions.

推荐答案

SDL2-devel-2.0.0-mingw.tar.gz 包含两个32位库( i686-w64-mingw32 目录)和64位库( x86_64-w64-mingw32 目录).

SDL2-devel-2.0.0-mingw.tar.gz contains both 32-bit libraries (i686-w64-mingw32 directory) and 64-bit libraries (x86_64-w64-mingw32 directory).

该错误是由于该库的64位版本与32位编译器一起使用引起的.

The error was caused by using a 64-bit version of the library with a 32-bit compiler.

这篇关于无法在MinGW上安装SDL,获得对WinMain @ 16的未定义引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 00:56