SDL and Devcpp and a lot of trouble

Hi,
I want to program SDL on windows, but nothing works. My Compiler is
DevC++ 4 and I did everything, I was told to do by several Websites.
I unzipped sdlDevCPP-1.2.4.zip and moved the header files to the
devc++ include directory and added the subdirectory (/include/SDL/) to
the searchpath of devc++. Then I moved the content of the unzipped
/lib to the lib-directory of devc++. Then I added “-lmingw32 -lSDLmain -lSDL”
(w/o the quotes) to “the further linker options” box.
A single compile of test.cpp including a blank int main{} and a
#include <SDL.h> made no problems. But when I insert any SDL-command,
the linker answerd:######
D:\C\DEVCPP\LIB\libSDLmain.a(SDL_main.o): In function console_main': /home/hercules/release/SDL-1.2.4/src/main/SDL_main.c:227: undefined reference toSDL_main’

Hint: I have no "/home/hercules/release/… " directory, neither on Windows,
nor on Linux

Google couldn’t help me.
Under Linux everything works fine, but I want to compile my programs
for Windows too.

Thank you
Peter Harding

You can compile a Windows program in Linux using mingw32.
If you’d like an example makefile, email me directly and I’ll send you one.

JeffOn Monday 31 March 2003 10:54 am, Peter Harding wrote:

Under Linux everything works fine, but I want to compile my programs
for Windows too.

gipsde at gmx.net wrote:

A single compile of test.cpp including a blank int main{} and a
#include <SDL.h> made no problems. But when I insert any SDL-command,
the linker answerd:

D:\C\DEVCPP\LIB\libSDLmain.a(SDL_main.o): In function console_main': /home/hercules/release/SDL-1.2.4/src/main/SDL_main.c:227: undefined reference toSDL_main’

change int main() to int main(int argc, char *argv[])

Thank you
Peter Harding

You’re welcome,

Tony

There is no need of doing that as long as I’m not interested into getting
parameters:

int main(void)
{
[source here]
return 0;
}Am Dienstag, 1. April 2003 00:10 schrieb Anthony Lewis:

change int main() to int main(int argc, char *argv[])

Under Linux everything works fine, but I want to compile my programs
for Windows too.

You can compile a Windows program in Linux using mingw32.

Yes but sometimes I need OS-linked functions and that’s why I also wan’t to
compile my programs in Windows98.

If you’d like an example makefile, email me directly and I’ll send you one.

How comfortable is it to compile Windows programs under Linux. I needn’t any
GUI for compiling programs, but I doesn’t want to write a new “how to compile
this program.txt” - file for each sourcecode I want to compile.

Thank you.Am Montag, 31. M?rz 2003 23:11 schrieb j_post:

On Monday 31 March 2003 10:54 am, Peter Harding wrote:

I unzipped sdlDevCPP-1.2.4.zip and moved the header files to the
devc++ include directory and added the subdirectory (/include/SDL/) to

I have no idea what sdlDevCPP-1.2.4.zip is but you dont need it. The
current Dev-CPP works fine.

D:\C\DEVCPP\LIB\libSDLmain.a(SDL_main.o): In function console_main': /home/hercules/release/SDL-1.2.4/src/main/SDL_main.c:227: undefined reference toSDL_main’

Use “-mwindows”. Example (from prior post):

gcc -mwindows -o png png.c -lmingw32 -lSDLmain -lSDL -lSDL_image

Hint: I have no "/home/hercules/release/… " directory, neither on Windows,
nor on Linux

What is hercules for?

Hello gipsde,

ggn> There is no need of doing that as long as I’m not interested into getting
ggn> parameters:

Instead of arguing that you don’t need the parameters, actually try
it. Why else ask for advice on a mailing list and then argue with it
when it comes your way?

You NEED to define your main function as “int main(int argc, char*
argv[])” for it to work with SDL. SDL itself will call your main(int,
char**) function after doing all of it’s initialisation. Just define
your main function as above and it will work.

If you don’t WANT the parameters, don’t use them. Simple.

This needs to be in the FAQs too, it’s asked so often… :slight_smile:

Neil

IMHO: Yes, you realy, realy need to include 'int main( int argc, char *argv[])'
or it will not compile propperly for you. Why? I dont remember the cause to it. Someone more into it can and will certainly explain it to you.

/Patrich
"gipsde at gmx.net" wrote …> Am Dienstag, 1. April 2003 00:10 schrieb Anthony Lewis:

change int main() to int main(int argc, char *argv[])
There is no need of doing that as long as I’m not interested into getting
parameters:

int main(void)
{
[source here]
return 0;
}


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

I can only say there is ONE dependency more in that gcc-statement. Complete:

-mwindows -lmingw32 -lSDLmain -lSDL -lSDL_ttf -lSDL_image -lm

That is what I am using in my Dev-C++ Compiler Options.

/Patrich
Stanley Brown wrote …> >

I unzipped sdlDevCPP-1.2.4.zip and moved the header files to the
devc++ include directory and added the subdirectory (/include/SDL/) to

I have no idea what sdlDevCPP-1.2.4.zip is but you dont need it. The
current Dev-CPP works fine.

D:\C\DEVCPP\LIB\libSDLmain.a(SDL_main.o): In function console_main': /home/hercules/release/SDL-1.2.4/src/main/SDL_main.c:227: undefined reference toSDL_main’

Use “-mwindows”. Example (from prior post):

gcc -mwindows -o png png.c -lmingw32 -lSDLmain -lSDL -lSDL_image

Hint: I have no "/home/hercules/release/… " directory, neither on Windows,
nor on Linux

What is hercules for?


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

This needs to be in the FAQs too, it’s asked so often… :slight_smile:

Its been in the FAQ for some time.

Patrich-

SDL_ttf and SDL_image are not required parts of SDL. I do not know what
lib “m” is. Original poster was linking the basic SDL:

-lmingw32 -lSDLmain -lSDL

Appears original posters issue was due to main function though.

Patrich B wrote:>I can only say there is ONE dependency more in that gcc-statement. Complete:

-mwindows -lmingw32 -lSDLmain -lSDL -lSDL_ttf -lSDL_image -lm

That is what I am using in my Dev-C++ Compiler Options.

/Patrich
Stanley Brown <@Stanley_Brown> wrote …

I unzipped sdlDevCPP-1.2.4.zip and moved the header files to the
devc++ include directory and added the subdirectory (/include/SDL/) to

I have no idea what sdlDevCPP-1.2.4.zip is but you dont need it. The
current Dev-CPP works fine.

D:\C\DEVCPP\LIB\libSDLmain.a(SDL_main.o): In function console_main': /home/hercules/release/SDL-1.2.4/src/main/SDL_main.c:227: undefined reference toSDL_main’

Use “-mwindows”. Example (from prior post):

gcc -mwindows -o png png.c -lmingw32 -lSDLmain -lSDL -lSDL_image

Hint: I have no "/home/hercules/release/… " directory, neither on Windows,
nor on Linux

What is hercules for?


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Hello Stanley,

This needs to be in the FAQs too, it’s asked so often… :slight_smile:

SB> Its been in the FAQ for some time.

Where? I looked before I said it. I initially typed "It’s in the FAQ!"
and then checked and… it wasn’t. It isn’t on the website under FAQ
under General, Development or Linux, so…

Neil

http://www.libsdl.org/faq.php?action=listentries&category=4#48

Neil Griffiths wrote:>Hello Stanley,

This needs to be in the FAQs too, it’s asked so often… :slight_smile:

SB> Its been in the FAQ for some time.

Where? I looked before I said it. I initially typed "It’s in the FAQ!"
and then checked and… it wasn’t. It isn’t on the website under FAQ
under General, Development or Linux, so…

Neil


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

You can compile a Windows program in Linux using mingw32.

Yes but sometimes I need OS-linked functions and that’s why I also wan’t to
compile my programs in Windows98.

Can’t help you there. I do all my development in Linux and use Windoze only
for testing the executable code.

How comfortable is it to compile Windows programs under Linux. I needn’t
any GUI for compiling programs, but I doesn’t want to write a new “how to
compile this program.txt” - file for each sourcecode I want to compile.

‘make’ to build the Linux version, ‘make win’ to build the Windows version.
Same source code. Can’t get much easier than that.

JOn Tuesday 01 April 2003 10:55 am, you wrote:

Hello Stanley,

SB> http://www.libsdl.org/faq.php?action=listentries&category=4#48

Then it needs to be moved, this shouldn’t be in the Windows specific
section. Given SDL is used on many platforms, the way that you declare
your main function is pretty platform independant, don’t you think? :slight_smile:

There’s not much point in having a FAQ if it’s split up like that. It
should definitely be in the “Development” section.

Neil

Stanley Brown wrote:

Patrich-

SDL_ttf and SDL_image are not required parts of SDL. I do not know what
lib “m” is. Original poster was linking the basic SDL:

-lm means Link math.h

Greetings Peter harding