# undefined reference to WinMain@16'

6 replies to this topic

### #1lefti

New Member

• Members
• 17 posts

Posted 22 September 2007 - 04:15 PM

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??

### #2SamuraiCrow

Senior Member

• Members
• 459 posts

Posted 22 September 2007 - 04:21 PM

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

### #3lefti

New Member

• Members
• 17 posts

Posted 22 September 2007 - 04:26 PM

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

### #4lefti

New Member

• Members
• 17 posts

Posted 22 September 2007 - 04:29 PM

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?

### #5SamuraiCrow

Senior Member

• Members
• 459 posts

Posted 24 September 2007 - 04:38 PM

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.)

### #6lefti

New Member

• Members
• 17 posts

Posted 24 September 2007 - 08:05 PM

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

### #7SamuraiCrow

Senior Member

• Members
• 459 posts

Posted 25 September 2007 - 05:24 PM

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.

#### 1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users