entry point must be defined???

Started by
13 comments, last by IvanYosifov 12 years, 9 months ago
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++ !!!-----------------------------
Advertisement
I think you need to add /SUBSYSTEM:WINDOWS to the linker options. I can go check if that doesn't work.
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++ !!!-----------------------------
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.
Quote:Original post by misterPhyrePhox
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.


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++ !!!-----------------------------
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).
If you want use SDL in Visual studio, I think you have to set "use default libraries" (or whatever it's called) to off.
Try linking SDLmain before SDL.
To read the documentation is always a Good Thing :)
Anyway, directly from SDL documentation:

Quote:
Creating a Project with SDL

Create a project as a Win32 Application.

Create a C++ file for your project.

Set the C runtime to "Multi-threaded DLL" in the menu: Project|Settings|C/C++ tab|Code Generation|Runtime Library .

Add the SDL include directory to your list of includes in the menu: Project|Settings|C/C++ tab|Preprocessor|Additional include directories .
VC7 Specific: Instead of doing this I find it easier to add the include and library directories to the list that VC7 keeps. Do this by selecting Tools|Options|Projects|VC++ Directories and under the "Show Directories For:" dropbox select "Include Files", and click the "New Directory Icon" and add the [SDLROOT]\include directory (ex. If you installed to c:\SDL-1.2.5\ add c:\SDL-1.2.5\include). Proceed to change the dropbox selection to "Library Files" and add [SDLROOT]\lib.

The "include directory" I am referring to is the include folder within the main SDL directory (the one that this HTML file located within).

Now we're going to use the files that we had created earlier in the Build SDL step.

Copy the following files into your Project directory:

* SDL.dll

Add the following files to your project (It is not necessary to copy them to your project directory):

* SDL.lib
* SDLmain.lib

(To add them to your project, right click on your project, and select "Add files to project")

Instead of adding the files to your project it is more desireable to add them to the linker options: Project|Properties|Linker|Command Line and type the names of the libraries to link with in the "Additional Options:" box. Note: This must be done for each build configuration (eg. Release,Debug).


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!
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++ !!!-----------------------------

This topic is closed to new replies.

Advertisement