SDL Compiling Error

Started by
7 comments, last by oxxo 14 years, 5 months ago
Compilador: Default compiler Building Makefile: "H:\Vision 3\Iñaki\SDK - 2009\Virtual_Eyes\Makefile.win" Ejecutando make... make.exe -f "H:\Vision 3\Iñaki\SDK - 2009\Virtual_Eyes\Makefile.win" all g++.exe -c Virtual_Eyes.cpp -o Virtual_Eyes.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" g++.exe Virtual_Eyes.o -o "Eye Tracker.exe" -L"C:/Dev-Cpp/lib" -lwinmm -lmingw32 -mwindows -lSDLmain -lSDL -mwindows falcon.lib C:/Dev-Cpp/lib/SDL.lib C:/Dev-Cpp/lib/SDLmain.lib C:/Dev-Cpp/lib\SDLmain.lib(./Release/SDL_win32_main.obj)(.text[_main]+0x0):C:\SDL-1.2.11\Src\: multiple definition of `main' C:/Dev-Cpp/lib/libmingw32.a(main.o)(.text+0x0):main.c: first defined here Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized C:/Dev-Cpp/lib\SDLmain.lib(./Release/SDL_win32_main.obj)(.text[_main]+0x55):C:\SDL-1.2.11\Src\: undefined reference to `_alloca_probe' C:/Dev-Cpp/lib\SDLmain.lib(./Release/SDL_win32_main.obj)(.text[_main]+0xcd):C:\SDL-1.2.11\Src\: undefined reference to `SDL_main' C:/Dev-Cpp/lib\SDLmain.lib(./Release/SDL_win32_main.obj)(.text[_WinMain@16]+0x181):C:\SDL-1.2.11\Src\: undefined reference to `_alloca_probe' C:/Dev-Cpp/lib\SDLmain.lib(./Release/SDL_win32_main.obj)(.text[_WinMain@16]+0x1c1):C:\SDL-1.2.11\Src\: undefined reference to `_alloca_probe' collect2: ld returned 1 exit status make.exe: *** ["Eye] Error 1 As you can see I added the compiler linker options -lwinmm -lmingw32 -mwindows -lSDLmain -lSDL . Part of the code: #include <windows.h> #include "SDL/SDL.h" #include "falcon.h" #include <math.h> #pragma comment(lib,"SDL.lib") #pragma comment(lib,"SDLmain.lib") #define OK 1 // Operacion exitosa (encuantra todos los parametros) #define PURK_NO 2 // No encuentra purkinge pero si pupila #define NO 0 // Operacion fracasada (no encuentra nada) #define DATO_NO -99999 // Parametro no encontrado #define GRAF_NO 3 // Error en libreria grafica sdl (incompatibilidad con placa de video) class procesador { ................... Can anyone help me?
Advertisement
Compilador: Default compiler
Ejecutando g++.exe...
g++.exe "H:\Vision 3\Iñaki\CD Vista Finder\SDK - 2008\Virtual_Eyes\Virtual_Eyes.cpp" -o "H:\Vision 3\Iñaki\CD Vista Finder\SDK - 2008\Virtual_Eyes\Virtual_Eyes.exe" -I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\Dev-Cpp\include\c++\3.4.2" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib" -lwinmm -lmingw32 -mwindows -lSDLmain -lSDL -lfalcon
C:\Dev-Cpp\lib/libSDLmain.a(SDL_win32_main.o)(.text+0x397): In function `console_main':
/Users/hercules/trunk/SDL-1.2/./src/main/win32/SDL_win32_main.c:217: undefined reference to `SDL_main'
collect2: ld returned 1 exit status

Ejecución Terminada

This is the True Error..

Any Ideas?
Try moving -lmingw32 to the end of the linker list. The commands defined in it may be called by SDLmain and SDL so they should be defined last. Remember, order is significant when linking.

-edit-
Also, try moving -lSDLmain after -lSDL because that's where SDLmain is called from, I think. I'm not quite so sure about this one.
samuraicrow Thanks for your reply. Now the new error is:

Compilador: Default compiler
Ejecutando g++.exe...
g++.exe "H:\Vision 3\Iñaki\CD Vista Finder\SDK - 2008\Virtual_Eyes\Virtual_Eyes.cpp" -o "H:\Vision 3\Iñaki\CD Vista Finder\SDK - 2008\Virtual_Eyes\Virtual_Eyes.exe" -I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\Dev-Cpp\include\c++\3.4.2" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib" -lSDLmain -lSDL -lfalcon -mwindows -lwinmm -lmingw32
C:\Dev-Cpp\lib/libmingw32.a(main.o)(.text+0x106):main.c: undefined reference to `WinMain@16'
collect2: ld returned 1 exit status

Ejecución Terminada

And the order of the linkers -lSDLmain -lSDL -lfalcon -mwindows -lwinmm -lmingw32.

Any Ideas?
Try setting the linker order to: -lSDL -lSDLmain -lfalcon -mwindows -lwinmm -lmingw32
"-lSDL -lSDLmain -lfalcon -mwindows -lwinmm -lmingw32"
I tried that sequence and the error is the same :s
Oh ok. Try setting the linker order to: -lSDL -lfalcon -mwindows -lwinmm -lmingw32 -lSDLmain
I don't have a single idea of what "falcon" is, but for SDL:

-lmingw32 -lSDLmain -lSDL

is the correct sequence. That leads to the full sequence:

-lmingw32 -lfalcon -lSDLmain -lSDL -lwinmm -mwindows

which should work regardless of wheter "falcon" relies on SDL or not.
I found the error, the problem was that my project was set to "Win32 GUI Grafico" and really is a library for windows dll that was compiled, after all, thanks for your help samuraicrow.

This topic is closed to new replies.

Advertisement