SDL.h and MS VS .NET 2002

Hello sdl,

When I include SDL.h under MS VS .NET 2002 in a simple program like
this:

#include “SDL.h”

int main()
{
return 0;
}

at compilation time it says “unresolved external symbol _main
referenced in function _mainCRTStartup”.

In more complex programs, after including SDL.h compilation gives all
kinds of weird syntax errors.

But if I don’t include SDL.h it works just fine, except I can’t use
SDL :frowning:

The VS .NET project is a “console application” project. It makes no
difference if I create a “Windows application” project.

I have the include and lib paths set ok and I include SDL.lib to the
library list. If I add SDLmain.lib too I get some more symbol
conflicts with some MS libs that I can’t exclude either.

Currently I use a workaround to the problem by having a .h + .cpp
couple but I don’t include the .h file anywhere. Instead, I have
non-C++ wrapper functions in the .cpp which I refer using the "extern"
keyword in the rest of the program, but this isn’t too elegant and
it’s time consuming since I can’t use the objects I define directly.

Under Linux, with g++ 3.3.4, it works just fine.

SDL version on both Windows and Linux is 1.2.7.

Anyone knows of a way to use this in a normal way undes VS .NET 2002?
Thanks.–
Best regards,
Radu mailto:radu.c at newflavorstudio.com

Sorry, my bad. I didn’t read the post to the last. Just disregard these
two posts.

-yzt

Uplink wrote:> Hello sdl,

When I include SDL.h under MS VS .NET 2002 in a simple program like
this:

#include “SDL.h”

int main()
{
return 0;
}

at compilation time it says “unresolved external symbol _main
referenced in function _mainCRTStartup”.

In more complex programs, after including SDL.h compilation gives all
kinds of weird syntax errors.

But if I don’t include SDL.h it works just fine, except I can’t use
SDL :frowning:

The VS .NET project is a “console application” project. It makes no
difference if I create a “Windows application” project.

I have the include and lib paths set ok and I include SDL.lib to the
library list. If I add SDLmain.lib too I get some more symbol
conflicts with some MS libs that I can’t exclude either.

Currently I use a workaround to the problem by having a .h + .cpp
couple but I don’t include the .h file anywhere. Instead, I have
non-C++ wrapper functions in the .cpp which I refer using the "extern"
keyword in the rest of the program, but this isn’t too elegant and
it’s time consuming since I can’t use the objects I define directly.

Under Linux, with g++ 3.3.4, it works just fine.

SDL version on both Windows and Linux is 1.2.7.

Anyone knows of a way to use this in a normal way undes VS .NET 2002?
Thanks.

Hi,

You just have to link with “SDL_main” (and “SDL”, of course) library.

-yzt

Uplink wrote:> Hello sdl,

When I include SDL.h under MS VS .NET 2002 in a simple program like
this:

#include “SDL.h”

int main()
{
return 0;
}

at compilation time it says “unresolved external symbol _main
referenced in function _mainCRTStartup”.

In more complex programs, after including SDL.h compilation gives all
kinds of weird syntax errors.

But if I don’t include SDL.h it works just fine, except I can’t use
SDL :frowning:

The VS .NET project is a “console application” project. It makes no
difference if I create a “Windows application” project.

I have the include and lib paths set ok and I include SDL.lib to the
library list. If I add SDLmain.lib too I get some more symbol
conflicts with some MS libs that I can’t exclude either.

Currently I use a workaround to the problem by having a .h + .cpp
couple but I don’t include the .h file anywhere. Instead, I have
non-C++ wrapper functions in the .cpp which I refer using the "extern"
keyword in the rest of the program, but this isn’t too elegant and
it’s time consuming since I can’t use the objects I define directly.

Under Linux, with g++ 3.3.4, it works just fine.

SDL version on both Windows and Linux is 1.2.7.

Anyone knows of a way to use this in a normal way undes VS .NET 2002?
Thanks.

In Visual Studio, the project must be a Multithreaded DLL in the project
properties’s code generation ( and a Multithreaded
Debug DLL for the debug project)

This is explained in the SDL’s visual studio configuration.> ----- Original Message -----

From: advantis@gmx.net (Uplink)
To:
Sent: Wednesday, September 15, 2004 10:30 AM
Subject: [SDL] SDL.h and MS VS .NET 2002

Hello sdl,

When I include SDL.h under MS VS .NET 2002 in a simple program like
this:

#include “SDL.h”

int main()
{
return 0;
}

at compilation time it says “unresolved external symbol _main
referenced in function _mainCRTStartup”.

In more complex programs, after including SDL.h compilation gives all
kinds of weird syntax errors.

But if I don’t include SDL.h it works just fine, except I can’t use
SDL :frowning:

The VS .NET project is a “console application” project. It makes no
difference if I create a “Windows application” project.

I have the include and lib paths set ok and I include SDL.lib to the
library list. If I add SDLmain.lib too I get some more symbol
conflicts with some MS libs that I can’t exclude either.

Currently I use a workaround to the problem by having a .h + .cpp
couple but I don’t include the .h file anywhere. Instead, I have
non-C++ wrapper functions in the .cpp which I refer using the "extern"
keyword in the rest of the program, but this isn’t too elegant and
it’s time consuming since I can’t use the objects I define directly.

Under Linux, with g++ 3.3.4, it works just fine.

SDL version on both Windows and Linux is 1.2.7.

Anyone knows of a way to use this in a normal way undes VS .NET 2002?
Thanks.


Best regards,
Radu mailto:radu.c at newflavorstudio.com


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

You must use following definition on WinOS:
int main(int argc, char *argv[])On Wed, 2004-09-15 at 10:30, Uplink wrote:

#include “SDL.h”

int main()


Ivo Danihelka

In more complex programs, after including SDL.h compilation gives all
kinds of weird syntax errors.

There are a number of little settings that have to be adjusted before Visual
Studio will build an SDL project. The following web page documents them
all: http://pgdc.purdue.org/sdltutorial/sdl_setup.html--
David Ludwig
davidl funkitron.com
http://www.funkitron.com

The problem is that the linker needs to be able to access the lib files as
well as the header files. You can do this easily in VS by adding lines like
this near your includes:

#pragma comment(lib, “SDL.lib”)
#pragma comment(lib, “SDLmain.lib”)
//SDL_Image is a library for loading jpg,png,etc…
#pragma comment(lib, “SDL_Image.lib”)
//SDL_ttf is a library for text output
//(there are of course other possibilities to do this)
#pragma comment(lib, “SDL_ttf.lib”)
//SDL_mixer is essential for sound/music…
#pragma comment(lib, “SDL_mixer.lib”)

That’ll fix you right up

----Original Message Follows----From: advantis@gmx.net (Uplink)
Reply-To: Uplink ,“A list for developers using the SDL
library. (includesSDL-announce)”
To: sdl at libsdl.org
Subject: [SDL] SDL.h and MS VS .NET 2002
Date: Wed, 15 Sep 2004 11:30:45 +0300

Hello sdl,

When I include SDL.h under MS VS .NET 2002 in a simple program like
this:

#include “SDL.h”

int main()
{
return 0;
}

at compilation time it says “unresolved external symbol _main
referenced in function _mainCRTStartup”.

In more complex programs, after including SDL.h compilation gives all
kinds of weird syntax errors.

But if I don’t include SDL.h it works just fine, except I can’t use
SDL :frowning:

The VS .NET project is a “console application” project. It makes no
difference if I create a “Windows application” project.

I have the include and lib paths set ok and I include SDL.lib to the
library list. If I add SDLmain.lib too I get some more symbol
conflicts with some MS libs that I can’t exclude either.

Currently I use a workaround to the problem by having a .h + .cpp
couple but I don’t include the .h file anywhere. Instead, I have
non-C++ wrapper functions in the .cpp which I refer using the "extern"
keyword in the rest of the program, but this isn’t too elegant and
it’s time consuming since I can’t use the objects I define directly.

Under Linux, with g++ 3.3.4, it works just fine.

SDL version on both Windows and Linux is 1.2.7.

Anyone knows of a way to use this in a normal way undes VS .NET 2002?
Thanks.


Best regards,
Radu mailto:radu.c at newflavorstudio.com


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

Hi
I am new to SDL and faced the same problem.
By including SDLmain.lib solved my problem.
Hope this works for you too.
Hemu.===========

Hello sdl,

When I include SDL.h under MS VS .NET 2002 in a simple program like
this:

#include “SDL.h”

int main()
{
return 0;
}

at compilation time it says “unresolved external symbol _main
referenced in function _mainCRTStartup”.