Jump to content

  • Log In with Google      Sign In   
  • 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.

  • This topic is locked This topic is locked
14 replies to this topic

#1 dudedbz1   Banned   -  Reputation: 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++ !!!-----------------------------

Sponsor:

#2 Cocalus   Members   -  Reputation: 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   -  Reputation: 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_main
main.obj : error LNK2019: unresolved external symbol _SDL_SetVideoMode referenced in function _SDL_main
main.obj : error LNK2019: unresolved external symbol _SDL_Init referenced in function _SDL_main
LIBCMT.lib(wincrt0.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
C:\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++ !!!-----------------------------

#4 misterPhyrePhox   Members   -  Reputation: 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   -  Reputation: 100

Like
0Likes
Like

Posted 07 November 2005 - 03:29 PM

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

#6 Cocalus   Members   -  Reputation: 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).

#7 Kelly G   Members   -  Reputation: 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.

#8 deavik   Members   -  Reputation: 570

Like
0Likes
Like

Posted 07 November 2005 - 04:09 PM

Try linking SDLmain before SDL.

#9 MajinMusashi   Members   -  Reputation: 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:

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!

#10 dudedbz1   Banned   -  Reputation: 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++ !!!-----------------------------

#11 matthughson   Members   -  Reputation: 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   -  Reputation:

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.

#13 templewulf   Members   -  Reputation: 526

Like
0Likes
Like

Posted 08 November 2005 - 05:52 AM

Quote:
Original post by matthughson
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


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:

  1. Turn on multi-threaded DLLs.
  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
  5. Include SDL headers
  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")
#endif

int main(int argc, char** argv)
{
return 0;
}





#14 Cocalus   Members   -  Reputation: 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).

#15 ZombieBrains   Members   -  Reputation: 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.



PARTNERS