1
votes

I started the lazyfoo SDL Tutorials(http://lazyfoo.net/SDL_tutorials/lesson01/windows/devcpp/index.php) and i followed the install instructions exactly as written but when i compile this -->

#include "SDL/SDL.h"

int main( int argc, char* args[] )
{
   //Start SDL
   SDL_Init( SDL_INIT_EVERYTHING );

   //Quit SDL
   SDL_Quit();

   return 0;    
}

This happens -->

c:\program files (x86)\dev-cpp\mingw64\x86_64-w64-mingw32\bin\ld.exe skipping incompatible C:/SDL-1.2.15/lib/libSDLmain.a when searching for -lSDLmain

c:\program files (x86)\dev-cpp\mingw64\x86_64-w64-mingw32\bin\ld.exe skipping incompatible C:/SDL-1.2.15/lib\libSDLmain.a when searching for -lSDLmain

c:\program files (x86)\dev-cpp\mingw64\x86_64-w64-mingw32\bin\ld.exe skipping incompatible C:/SDL-1.2.15/lib/libSDLmain.a when searching for -lSDLmain

c:\program files (x86)\dev-cpp\mingw64\x86_64-w64-mingw32\bin\ld.exe cannot find -lSDLmain

c:\program files (x86)\dev-cpp\mingw64\x86_64-w64-mingw32\bin\ld.exe skipping incompatible C:/SDL-1.2.15/lib/libSDL.dll.a when searching for -lSDL

c:\program files (x86)\dev-cpp\mingw64\x86_64-w64-mingw32\bin\ld.exe skipping incompatible C:/SDL-1.2.15/lib/libSDL.dll.a when searching for -lSDL

c:\program files (x86)\dev-cpp\mingw64\x86_64-w64-mingw32\bin\ld.exe cannot find -lSDL

C:\SDL Tutorial Projects\collect2.exe [Error] ld returned 1 exit status

I have DevC++ 5.4.1 and im trying to install SDL-devel-1.2.15-mingw32.tar.gz

Does this have anything to do with my problem?

I've tried everything and it just says skipping incompatible for libSDLmain.a and libSDL.dll.a.

3
You might be mixing up 32 and 64 bit version of libs or it could be this: stackoverflow.com/questions/7925926/…Zdeslav Vojkovic
I have 64bit Windows and there isnt a 64bit version of SDL Development Library on their website but in the instructions it says its ok if you put SDL.dll in C:\Windows\SysWOW64.Alex Moumoulidis
I am not an expert on SDL, but I believe that sdl.dll should go to SysWOW64 only if it is a 32-bit version of the dll, and you are builting 32-bit version of executableZdeslav Vojkovic

3 Answers

0
votes

c:\program files (x86)\dev-cpp\mingw64\x86_64-w64-mingw32\bin\ld.exe skipping incompatible C:/SDL-1.2.15/lib/libSDLmain.a when searching for -lSDLmain

You may have incompatible binaries. Why are you using a x64 compiler? Try installing MinGW and compiling with raw gcc.

If you try that, add MinGW/bin to your path and run gcc 'filelocation' -lmingw32 -lSDLmain -lSDL

Or try using a x86 version of Dev. Also IIRC -lSDLmain should come before -lSDL and on Windows you need to add -lmingw32 for it to link and work properly.

If all this fails, one sure way would be to grab same MinGW and use msys to compile SDL yourself.. just change into the directory and run

./configure
mingw32-make
0
votes

You should install Dev-C++ with MinGW for 32 bits and use this option to work with SDL

0
votes

I think it is happening because you are trying to compile a 64-bit application using 32-bit binaries. All you need to do is set a flag to compile your app as a 32-bit application, for example, gcc (or g++) main.cpp -o -m32, or, if you are using CMAKE add

set(CMAKE_C_FLAGS -m32)
set(CMAKE_CXX_FLAGS -m32)

at the beginning.