Release problem Visual Studio

Hi,
This is my first post, I did search the forum and google for this but none of the fixes I found have helped me out yet so hopfully somone will have an idea.

Im using SDL to make a project for college, I have most of the project finished and running fine, but when I try to build a release version I always get this:

Error 1 fatal error LNK1561: entry point must be defined

Debug runs perfectly. I am using windows xp and windows 7 on another pc, both are running visual studio 2008 professional.

I copyed the basic program from http://lazyfoo.net/SDL_tutorials/lesson01/index2.php here to check if it works on a very simple program and still I get the same error.

Has anyone else had this problem? Any ideas on how to fix it?

Did you also linked SDLmain ?On Wed, Mar 24, 2010 at 7:31 PM, DaleCantwell wrote:

Hi,
This is my first post, I did search the forum and google for this but none
of the fixes I found have helped me out yet so hopfully somone will have an
idea.

Im using SDL to make a project for college, I have most of the project
finished and running fine, but when I try to build a release version I
always get this:

Error 1 fatal error LNK1561: entry point must be defined

Debug runs perfectly. I am using windows xp and windows 7 on another pc,
both are running visual studio 2008 professional.

I copyed the basic program from
http://lazyfoo.net/SDL_tutorials/lesson01/index2.php here to check if it
works on a very simple program and still I get the same error.

Has anyone else had this problem? Any ideas on how to fix it?


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

I think I have properly linked it.
I’m not sure if I need to do anything with SDLmain, I picked it up that you include it and that was it, is any more required?
This is the simple program I am trying to make a release version of. Is there any problems there?

Code:

//Include SDL functions and datatypes
#include <Windows.h>
#include “SDL.h”
#include “SDL_main.h”

int main(int argc, char argv[])
{
//The images
SDL_Surface
hello = NULL;
SDL_Surface* screen = NULL;

//Start SDL
SDL_Init( SDL_INIT_EVERYTHING );

//Set up screen
screen = SDL_SetVideoMode( 640, 480, 32, SDL_SWSURFACE );

//Load image
hello = SDL_LoadBMP( "hello.bmp" );

//Apply image to screen
SDL_BlitSurface( hello, NULL, screen, NULL );

//Update Screen
SDL_Flip( screen );

//Pause
SDL_Delay( 2000 );

//Free the loaded image
SDL_FreeSurface( hello );

//Quit SDL
SDL_Quit();

return 0;

}

SDL_main.h is implicitly included using SDL.h.

You just need to configure your release settings to match your debug
settings with regards to libraries. You may have to add SDL_main.lib (or is
it SDLmain.lib?) to you “additional dependencies” section of your Release
mode configuration.On 25 March 2010 12:17, DaleCantwell wrote:

I think I have properly linked it.

Thanks everyone, I was missing this setting in the release version of the project.

SubSystem Windows (/SUBSYSTEM:WINDOWS) in the Linker->System setting.

Its working now.

After finally running into this, I noticed that an example source file was using

int main() {

and NOT

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

in STD C there is not signature difference
however, in MS VC and C++ there is a name mangling thingy…

FYI

SDL pretty much requires the two-arg main() signature on windows,
unless you want to write your own WinMain(). SDL provides a default
implementation in SDLmain.lib, but it will only work with the two-arg
main.

The name mangling should be disabled because SDL.h defines main as
SDL_main, which is declared as extern “C” to disable any C++ name
mangling.

– BrianOn 31 March 2010 00:20, caburfoot wrote:

After finally running into this, I noticed that an example source file was
using

int main() {

and NOT

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

in STD C there is not signature difference
however, in MS VC and C++ there is a name mangling thingy…