Unresolved external reference error persists in win32

I’m trying to build sdl library on VC++ and VS.net.
But on both IDE’s I get link error message which says
“unresolved external SDL_main”. I’m not making the
mistake you have mentioned in the windows faq and have
build vc and vc7 sdl projects successfully but the
problem remains. Please, tell me what’s going wrong?=====


Do you Yahoo!?
Y! Messenger - Communicate in real time. Download now.
http://messenger.yahoo.com

There are two things that can cause this error AFAIK.
a) You havn’t linked to "SDLmain"
b) You do not have a main() function

Sameer Rafiq wrote:>I’m trying to build sdl library on VC++ and VS.net.

But on both IDE’s I get link error message which says
"unresolved external SDL_main". I’m not making the
mistake you have mentioned in the windows faq and have
build vc and vc7 sdl projects successfully but the
problem remains. Please, tell me what’s going wrong?

=====


Do you Yahoo!?
Y! Messenger - Communicate in real time. Download now.
http://messenger.yahoo.com


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

just to add a third, ive encountered this problem when…

c) The main function is declared incorrectly, ie it isnt…

int main(int argc,char **argv)> ----- Original Message -----

From: grembo@swiftdsl.com.au (grembo)
To: "A list for developers using the SDL library. (includes SDL-announce)"

Sent: Friday, August 20, 2004 4:47 PM
Subject: Re: [SDL] unresolved external reference error persists in win32

There are two things that can cause this error AFAIK.
a) You havn’t linked to "SDLmain"
b) You do not have a main() function

Sameer Rafiq wrote:

I’m trying to build sdl library on VC++ and VS.net.
But on both IDE’s I get link error message which says
"unresolved external SDL_main". I’m not making the
mistake you have mentioned in the windows faq and have
build vc and vc7 sdl projects successfully but the
problem remains. Please, tell me what’s going wrong?

=====


Do you Yahoo!?
Y! Messenger - Communicate in real time. Download now.
http://messenger.yahoo.com


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


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

Here I’m writing the steps in detail:

  1. I extract the visualc.zip file into source folder (

  2. Open the workspace file and build both projects
    without any errors.

  3. Create an empty win32 application project and a new
    .cpp file and copy paste “sdl initialization code” (
    from sdl documentaion )

  4. Set the project settings runtime to Multithreaded
    DLL.

  5. Tool->Options->Directories tab->include
    E:\GAME\SDL\WIN32\SDL-1.2.7\INCLUDE and lib
    E:\GAME\SDL\WIN32\SDL-1.2.7\LIB
    Now there is a confusion in win32 faq which is as
    follows " The “include directory” I am referring to is
    the include folder within the main SDL directory (the
    one that this HTML file located within)." This html
    file is in win32 develop folder and source folder. I
    have tried both approaches first include the file from
    win32 and then from source folder but none worked.

  6. Copy the SDL.dll file in my project folder and add
    SDL.lib and SDLmain.lib to my project.

  7. After compiling the first error is about exit()
    function which is
    "e:\game\sdl\examples\ex1\ex1.cpp(11) : error C2065:
    ‘exit’ : undeclared identifier"

  8. After commenting out exit() and using return 0 this
    error occurs "SDLmain.lib(SDL_win32_main.obj) : error
    LNK2001: unresolved external symbol _SDL_main"
    Please tell me what’s missing . The code is as
    follows:

#include “SDL.h” /* All SDL App’s need this */
#include <stdio.h>

int main() {

printf("Initializing SDL.\n");

/* Initialize defaults, Video and Audio */
if((SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO)==-1))

{
printf(“Could not initialize SDL: %s.\n”,
SDL_GetError());
exit(-1);
}

printf("SDL initialized.\n");

printf("Quiting SDL.\n");

/* Shutdown all subsystems */
SDL_Quit();

printf("Quiting....\n");

exit(0);

}

— Alan Wolfe wrote:> just to add a third, ive encountered this problem

when…

c) The main function is declared incorrectly, ie it
isnt…

int main(int argc,char **argv)

----- Original Message -----
From: “grembo”
To: "A list for developers using the SDL library.
(includes SDL-announce)"

Sent: Friday, August 20, 2004 4:47 PM
Subject: Re: [SDL] unresolved external reference
error persists in win32

There are two things that can cause this error
AFAIK.
a) You havn’t linked to "SDLmain"
b) You do not have a main() function

Sameer Rafiq wrote:

I’m trying to build sdl library on VC++ and
VS.net.

But on both IDE’s I get link error message which
says

“unresolved external SDL_main”. I’m not making
the

mistake you have mentioned in the windows faq and
have

build vc and vc7 sdl projects successfully but
the

problem remains. Please, tell me what’s going
wrong?

=====


Do you Yahoo!?
Y! Messenger - Communicate in real time. Download
now.

http://messenger.yahoo.com


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


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


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

=====


Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail

Here I’m writing the steps in detail:

  1. I extract the visualc.zip file into source folder (

  2. Open the workspace file and build both projects
    without any errors.

  3. Create an empty win32 application project and a new
    .cpp file and copy paste “sdl initialization code” (
    from sdl documentaion )

  4. Set the project settings runtime to Multithreaded
    DLL.

  5. Tool->Options->Directories tab->include
    E:\GAME\SDL\WIN32\SDL-1.2.7\INCLUDE and lib
    E:\GAME\SDL\WIN32\SDL-1.2.7\LIB
    Now there is a confusion in win32 faq which is as
    follows " The “include directory” I am referring to is
    the include folder within the main SDL directory (the
    one that this HTML file located within)." This html
    file is in win32 develop folder and source folder. I
    have tried both approaches first include the file from
    win32 and then from source folder but none worked.

  6. Copy the SDL.dll file in my project folder and add
    SDL.lib and SDLmain.lib to my project.

  7. After compiling the first error is about exit()
    function which is
    "e:\game\sdl\examples\ex1\ex1.cpp(11) : error C2065:
    ‘exit’ : undeclared identifier"

  8. After commenting out exit() and using return 0 this
    error occurs "SDLmain.lib(SDL_win32_main.obj) : error
    LNK2001: unresolved external symbol _SDL_main"
    Please tell me what’s missing . The code is as
    follows:

#include “SDL.h” /* All SDL App’s need this */
#include <stdio.h>

int main() {

This needs to be:

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

This is in the FAQ:
http://www.libsdl.org/faq.php?action=listentries&category=4#48

cheers,
John.On Saturday 21 August 2004 11:58, Sameer Rafiq wrote:

printf(“Initializing SDL.\n”);

/* Initialize defaults, Video and Audio */
if((SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO)==-1))
{
printf(“Could not initialize SDL: %s.\n”,
SDL_GetError());
exit(-1);
}

printf(“SDL initialized.\n”);

printf(“Quiting SDL.\n”);

/* Shutdown all subsystems */
SDL_Quit();

printf(“Quiting…\n”);

exit(0);
}

— Alan Wolfe wrote:

just to add a third, ive encountered this problem
when…

c) The main function is declared incorrectly, ie it
isnt…

int main(int argc,char **argv)

----- Original Message -----
From: “grembo”
To: "A list for developers using the SDL library.
(includes SDL-announce)"

Sent: Friday, August 20, 2004 4:47 PM
Subject: Re: [SDL] unresolved external reference
error persists in win32

There are two things that can cause this error

AFAIK.

a) You havn’t linked to "SDLmain"
b) You do not have a main() function

Sameer Rafiq wrote:

I’m trying to build sdl library on VC++ and

VS.net.

But on both IDE’s I get link error message which

says

“unresolved external SDL_main”. I’m not making

the

mistake you have mentioned in the windows faq and

have

build vc and vc7 sdl projects successfully but

the

problem remains. Please, tell me what’s going

wrong?

=====


Do you Yahoo!?
Y! Messenger - Communicate in real time. Download

now.

http://messenger.yahoo.com


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


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


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

=====


Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail


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