• Create Account

## entry point must be defined???

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

14 replies to this topic

### #1 dudedbz1   Banned

100
Like
0Likes
Like

Posted 07 November 2005 - 03:02 PM

Huh? I have a simple SDL app running in Visual C++ Studio 2k5 Express... Well, not running though. I get this:
LINK : fatal error LNK1561: entry point must be defined

What is this? I'm guess its because I'm not linking with SDL. Well, how can I accomplish this with Visual C++ Studio 2k5 Express? I looked in 'Project' 'Properties', but found nothing.. Any ideas?
-----------------------------....::::DRAGON BALL Z::::....C<<"+"<<"+"; // Go C++ !!!-----------------------------

### #2Cocalus  Members

554
Like
0Likes
Like

Posted 07 November 2005 - 03:12 PM

I think you need to add /SUBSYSTEM:WINDOWS to the linker options. I can go check if that doesn't work.

### #3 dudedbz1   Banned

100
Like
0Likes
Like

Posted 07 November 2005 - 03:18 PM

Ok, I think that did away with that error... But now I get more:
main.obj : error LNK2019: unresolved external symbol _SDL_Quit referenced in function _SDL_mainmain.obj : error LNK2019: unresolved external symbol _SDL_SetVideoMode referenced in function _SDL_mainmain.obj : error LNK2019: unresolved external symbol _SDL_Init referenced in function _SDL_mainLIBCMT.lib(wincrt0.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartupC:\Documents and Settings\Administrator\Desktop\C++\Visual C++\cApp\Debug\cApp.exe : fatal error LNK1120: 4 unresolved externals

I guess thats from not linking, but HOW DO I LINK WITH THIS THING??? LOl, its weird... there's no simple -lSDLmain -lSDL thing-a-mo-bob like in MingW...
-----------------------------....::::DRAGON BALL Z::::....C<<"+"<<"+"; // Go C++ !!!-----------------------------

### #4misterPhyrePhox  Members

196
Like
0Likes
Like

Posted 07 November 2005 - 03:24 PM

To link the SDL libraries, you can use the #pragma comment compiler directive at the beginning of your main.cpp file or whatever:
#pragma comment(lib, "SDL.lib")
#pragma comment(lib, "SDLmain.lib")

You could also go to Project->Properties->Linker->Input->Additional Dependencies, I think. I use the pragma comment more just because I can look at the code and see what I'm linking.

### #5 dudedbz1   Banned

100
Like
0Likes
Like

Posted 07 November 2005 - 03:29 PM

Quote:
 Original post by misterPhyrePhoxTo link the SDL libraries, you can use the #pragma comment compiler directive at the beginning of your main.cpp file or whatever:#pragma comment(lib, "SDL.lib")#pragma comment(lib, "SDLmain.lib")You could also go to Project->Properties->Linker->Input->Additional Dependencies, I think. I use the pragma comment more just because I can look at the code and see what I'm linking.

You are, the best.

One more problem now... Look:
msvcrt.lib(MSVCR80.dll) : error LNK2005: _exit already defined in LIBCMT.lib(crt0dat.obj)msvcrt.lib(MSVCR80.dll) : error LNK2005: __isctype already defined in LIBCMT.lib(isctype.obj)LINK : fatal error LNK1104: cannot open file 'uuid.lib'

I have never seen anything like this before...
-----------------------------....::::DRAGON BALL Z::::....C<<"+"<<"+"; // Go C++ !!!-----------------------------

### #6Cocalus  Members

554
Like
0Likes
Like

Posted 07 November 2005 - 03:36 PM

Do you have it set for a multithreaded dll runtime?

If you still need uuid.lib I think it comes with the SDK you can download from microsoft (big download for one file though).

### #7Kelly G  Members

358
Like
0Likes
Like

Posted 07 November 2005 - 03:51 PM

If you want use SDL in Visual studio, I think you have to set "use default libraries" (or whatever it's called) to off.

### #8deavik  Members

570
Like
0Likes
Like

Posted 07 November 2005 - 04:09 PM

### #9MajinMusashi  Members

182
Like
0Likes
Like

Posted 07 November 2005 - 04:33 PM

To read the documentation is always a Good Thing :)
Anyway, directly from SDL documentation:

Quote:

The "Multi-threaded DLL" stuff will avoid errors like "error LNK2005: _exit already defined in LIBCMT.lib". This happens because the library was built under this compiler setting (multi-threaded environment), and your compiler must do the same thing to avoid linker errors.

Linking "SDLmain.lib" will avoid errors like "LNK1561: entry point must be defined".

I prefer to do all the linking stuff from inside the source code through the use of #pragma preprocessor directives, like this:
// Microsoft Visual C++ specific#ifdef _MSC_VER  #pragma comment( lib, "OpenGL32.lib" )  // Link against OpenGL  #pragma comment( lib, "SDL.lib" )	  // Link against SDL  #pragma comment( lib, "SDLmain.lib" )	  // Link against SDLmain  ...#endif

Goodbye!

### #10 dudedbz1   Banned

100
Like
0Likes
Like

Posted 08 November 2005 - 03:23 AM

I did all that, step by step... It gives me this:
LINK : fatal error LNK1561: entry point must be defined

What does that mean? I'm linking with SDLmain.lib and SDL.lib, and have it set to 'Multithreaded DLL'. What am I doing wrong?
-----------------------------....::::DRAGON BALL Z::::....C<<"+"<<"+"; // Go C++ !!!-----------------------------

### #11matthughson  Members

588
Like
0Likes
Like

Posted 08 November 2005 - 05:29 AM

It seems wierd that noone else suggest this, so I have a feeling I'm wrong, but doesn't that just mean that you are missing a "main" function (aka the entry point for your program)? I belive SDL has a special definition of what main should look like too (I'm sure it's in the docs somewhere).

Matt
__________________________________[ Website ] [ Résumé ] [ matthughson[dot]com]Contact ][ Have I been Helpful? Hook me up! ]

### #12 Anonymous Poster_Anonymous Poster_*   Guests

0Likes

Posted 08 November 2005 - 05:30 AM

If you are doing your project in debug mode, you need to change your DLL type to Multithreaded Debug DLL.

### #13templewulf  Members

526
Like
0Likes
Like

Posted 08 November 2005 - 05:52 AM

Quote:
 Original post by matthughsonIt seems wierd that noone else suggest this, so I have a feeling I'm wrong, but doesn't that just mean that you are missing a "main" function (aka the entry point for your program)? I belive SDL has a special definition of what main should look like too (I'm sure it's in the docs somewhere).Matt

Only kinda...it converts other main functions to SDL_main. By using regular main(), you satisfy MSVC's expectations, and SDL uses some kind o' macro to satisfy SDL's expectations.

Before coding:

2. Put the DLL in your project folder (or system folder, but I recommend against it).
3. Set up your compiler's include path to the SDL SDK folder
4. Set up your compiler's library path to the SDL SDK folder
6. Input Library files to the linker (with #pragma in MSVC)

I use:
#include <SDL.h>#include <SDL_main.h>#ifdef WIN32#pragma comment(lib,"SDL.lib")#pragma comment(lib,"SDL_main.lib")#endifint main(int argc, char** argv){return 0;}

### #14Cocalus  Members

554
Like
0Likes
Like

Posted 08 November 2005 - 12:16 PM

Check my first post about the linker options. This is specific to SDL and VC 8.0 (which Express 2k5 uses).

### #15ZombieBrains  Members

100
Like
0Likes
Like

Posted 28 June 2011 - 12:08 AM

Ive had this error. And I can only tell you this - something is wrong with your main function - check carefully whether you wrote it precisely as it should be. Different projects require different versions of main so check its correct spelling.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.