Getting the SDL started on devcpp?

I am new to SDL. I was trying to use it on devcpp 4.9.9.2 by starting off as
a c++ project. I copied the ming32 libraries & headers, but still not able
to get the sdl working…I’ve pasted my compile log here. It should help you
understand the problem. I am getting a link error: undefined reference to
`WinMain at 16’

-----compile log-------
Compiler: Default compiler
Building Makefile: “C:\Dev-Cpp\sdltest\Makefile.win"
Executing make…
make.exe -f “C:\Dev-Cpp\sdltest\Makefile.win” all
g++.exe main.o -o “sdltest.exe” -L"C:/Dev-Cpp/lib”
-L"C:/SDL/SDL-1.2.13/lib" …/…/SDL/SDL-1.2.13/lib/libSDLmain.a
…/…/SDL/SDL-1.2.13/lib/libSDL.dll.a

C:/Dev-Cpp/lib/libmingw32.a(main.o)(.text+0x106):main.c: undefined reference
to `WinMain at 16’
collect2: ld returned 1 exit status

make.exe: *** [sdltest.exe] Error 1

Execution terminated–
View this message in context: http://www.nabble.com/Getting-the-SDL-started-on-devcpp--tp18081707p18081707.html
Sent from the SDL mailing list archive at Nabble.com.

hi!
I’m a new to sdl too,but have you using extern “c” key words in your sdl codes?

2008-06-26

zhanglf

??? deostroll
??? 2008-06-26 09:11:32
??? sdl at lists.libsdl.org
???
??? [SDL] Getting the SDL started on devcpp?

I am new to SDL. I was trying to use it on devcpp 4.9.9.2 by starting off as
a c++ project. I copied the ming32 libraries & headers, but still not able
to get the sdl working…I’ve pasted my compile log here. It should help you
understand the problem. I am getting a link error: undefined reference to
WinMain at 16' -----compile log------- Compiler: Default compiler Building Makefile: "C:\Dev-Cpp\sdltest\Makefile.win" Executing make... make.exe -f "C:\Dev-Cpp\sdltest\Makefile.win" all g++.exe main.o -o "sdltest.exe" -L"C:/Dev-Cpp/lib" -L"C:/SDL/SDL-1.2.13/lib" ../../SDL/SDL-1.2.13/lib/libSDLmain.a ../../SDL/SDL-1.2.13/lib/libSDL.dll.a C:/Dev-Cpp/lib/libmingw32.a(main.o)(.text+0x106):main.c: undefined reference toWinMain at 16’
collect2: ld returned 1 exit status
make.exe: *** [sdltest.exe] Error 1
Execution terminated–
View this message in context: http://www.nabble.com/Getting-the-SDL-started-on-devcpp--tp18081707p18081707.html
Sent from the SDL mailing list archive at Nabble.com.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Under the project options include these lines on the linker commands
box.(and in this order, too!)
-lmingw32 -lSDLmain -lSDL -mwindows

This is what it took for my projects to work in Devc++. I eventually
switched to the free MS VC++, though.
Let us know if that does the trick!
-Dave> ----- Original Message -----

From: deostroll@gmail.com (deostroll)
To:
Sent: Wednesday, June 25, 2008 8:11 PM
Subject: [SDL] Getting the SDL started on devcpp?

I am new to SDL. I was trying to use it on devcpp 4.9.9.2 by starting off
as
a c++ project. I copied the ming32 libraries & headers, but still not able
to get the sdl working…I’ve pasted my compile log here. It should help
you
understand the problem. I am getting a link error: undefined reference to
`WinMain at 16’

-----compile log-------
Compiler: Default compiler
Building Makefile: “C:\Dev-Cpp\sdltest\Makefile.win"
Executing make…
make.exe -f “C:\Dev-Cpp\sdltest\Makefile.win” all
g++.exe main.o -o “sdltest.exe” -L"C:/Dev-Cpp/lib”
-L"C:/SDL/SDL-1.2.13/lib" …/…/SDL/SDL-1.2.13/lib/libSDLmain.a
…/…/SDL/SDL-1.2.13/lib/libSDL.dll.a

C:/Dev-Cpp/lib/libmingw32.a(main.o)(.text+0x106):main.c: undefined
reference
to `WinMain at 16’
collect2: ld returned 1 exit status

make.exe: *** [sdltest.exe] Error 1

Execution terminated


View this message in context:
http://www.nabble.com/Getting-the-SDL-started-on-devcpp--tp18081707p18081707.html
Sent from the SDL mailing list archive at Nabble.com.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I kind of need a sample code…–
View this message in context: http://www.nabble.com/Getting-the-SDL-started-on-devcpp--tp18081707p18127925.html
Sent from the SDL mailing list archive at Nabble.com.

I haven’t used Dev-C++ in a while (I switched to CodeBlocks since it’s still actively developed), but here you go:
Go to the Project menu item and find something like “Project Options”. Find the field that mentions “Linker Options”. In there, put “-lmingw32 -lSDLmain -lSDL” sans quotes (those are lowercase L’s in front). I’m not sure if -mwindows is necessary, but you can probably put it in there too.

Have you checked out Marius Andra’s tutorial? http://cone3d.gamedev.net/cgi-bin/index.pl?page=tutorials/gfxsdl/tut1

Jonny D----------------------------------------

Date: Thu, 26 Jun 2008 00:21:06 -0700
From: deostroll at gmail.com
To: sdl at lists.libsdl.org
Subject: Re: [SDL] Getting the SDL started on devcpp?

I kind of need a sample code…

View this message in context: http://www.nabble.com/Getting-the-SDL-started-on-devcpp--tp18081707p18127925.html
Sent from the SDL mailing list archive at Nabble.com.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I’m pretty sure your original error stems from the project being a Windows
app versus a console app. I think that distinction is made in the project
options, so try looking for those terms and selecting a console application.On Thu, Jun 26, 2008 at 7:32 AM, Jonathan Dearborn wrote:

I haven’t used Dev-C++ in a while (I switched to CodeBlocks since it’s
still actively developed), but here you go:
Go to the Project menu item and find something like “Project Options”.
Find the field that mentions “Linker Options”. In there, put “-lmingw32
-lSDLmain -lSDL” sans quotes (those are lowercase L’s in front). I’m not
sure if -mwindows is necessary, but you can probably put it in there too.

Have you checked out Marius Andra’s tutorial?
http://cone3d.gamedev.net/cgi-bin/index.pl?page=tutorials/gfxsdl/tut1

Jonny D


Date: Thu, 26 Jun 2008 00:21:06 -0700
From: deostroll at gmail.com
To: sdl at lists.libsdl.org
Subject: Re: [SDL] Getting the SDL started on devcpp?

I kind of need a sample code…

View this message in context:
http://www.nabble.com/Getting-the-SDL-started-on-devcpp--tp18081707p18127925.html
Sent from the SDL mailing list archive at Nabble.com.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org