0
101 Sep 22, 2007 at 16:15

Hello everyone,
I get an error when compiling the games i try to make with devc++
the error is undefined reference to WinMain@16’
can anyone help me??

#### 6 Replies

0
101 Sep 22, 2007 at 16:21

Either you are linking the SDL library in the wrong order or you have made your main subroutine something other than

int main(int argc, char *argv[])
`

It is important that you use that exact line of code for defining main because SDL has to convert the main function into WinMain.

In DevC++ the linker section of the project options under the project menu read something like this:

-lSDL -lmingw32

0
101 Sep 22, 2007 at 16:26

Actually yes I do write this line
but can you say the second part in pure english?? I dont undersand it…

0
101 Sep 22, 2007 at 16:29

Maybe I have not installed sdl properly,,, but how can this be posible,,, i have read 2 tuts on how to do it.. Any way, can you give me a link on an up-to-date tut?

0
101 Sep 24, 2007 at 16:38

Select the Project menu and click on “project options”. There will be a small box that appears on the screen. Click on the file tab at the top of that box that says “linker options”. Look to make sure that the linker options has a line that says “-lSDL -lmingw32” where the letter after the hyphen symbol is a lowercase L. This tells the compiler to link to the SDL library first, then the runtime library to the compiler.

(I hope this works, I’m typing this at school. I don’t have DevC++ right here and am typing these instruction from memory.)

0
101 Sep 24, 2007 at 20:05

thanks man…
it works..
Can you tell me which compiler do you use?

0
101 Sep 25, 2007 at 17:24

The compilers I usually use are Cygwin and MinGW when I am programming for Windows. DevC++ comes with MinGW but so does Code::Blocks and Code::Blocks is generally better if you use the nightly builds.