LINK : fatal error LNK1561: entry point must be defined

Jan 5, 2009 at 12:01am
compile error... it's even a miracle if i DONT have any error's compiling my code...
whatever. What's the problem this time? I can't see the error through all the errors.
(If you geuss i'm getting sick of compiling errors, you're right :P)

The mean errors
1
2
3
4
5
6
7
8
Compiling...
main.cpp
c:\documents and settings\toby hinloopen\my documents\visual studio 2005\projects\project2\project2\main.cpp(37) : warning C4715: 'SDL_main' : not all control paths return a value
Linking...
LINK : fatal error LNK1561: entry point must be defined
Build log was saved at "file://c:\Documents and Settings\Toby Hinloopen\My Documents\Visual Studio 2005\Projects\Project2\Project2\Debug\BuildLog.htm"
Project2 - 1 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


The code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <iostream>
#include <stdlib.h>
#include <SDL.h>

int main(int argc, char* argv[]){ //Our main program
        SDL_Surface *screen;
        SDL_Event event; //Events
        bool done = false; //Not done before we've started...

        if(SDL_Init(SDL_INIT_VIDEO) < 0){ //Could we start SDL_VIDEO?
                std::cerr << "Couldn't init SDL"; //Nope, output to stderr and quit
                exit(1);
        }

        atexit(SDL_Quit); //Now that we're enabled, make sure we cleanup

        screen = SDL_SetVideoMode(640, 480, 32, SDL_HWSURFACE | SDL_RESIZABLE); //Create a 640x480x32 resizable window

        if(!screen){ //Couldn't create window?
                std::cerr << "Couldn't create screen"; //Output to stderr and quit
                exit(1);
        }

        while(!done){ //While program isn't done
                while(SDL_PollEvent(&event)){ //Poll events
                        switch(event.type){ //Check event type
                        case SDL_QUIT: //User hit the X (or equivelent)
                                done = true; //Make the loop end
                                break; //We handled the event
                        case SDL_VIDEORESIZE: //User resized window
                                screen = SDL_SetVideoMode(event.resize.w, event.resize.h, 32,
                                        SDL_HWSURFACE | SDL_RESIZABLE); // Create new window
                                break; //Event handled, fetch next :)
                        } //Finished with current event
                } //Done with all events for now
        } //Program done, exited
}


*cries*
help :P

code taken from http://www.libsdl.org/cgi/docwiki.cgi/Resizable_Windows

using:
VC++ 2005
winXP SP3 32bit
Jan 5, 2009 at 12:05am
I was having a similar problem a few weeks back.
Also add SDLmain.lib to the linker input.
Jan 5, 2009 at 12:15am
aah, again something else.

this one i've never seen before:

After i pasted " #pragma comment(lib, "SDL.lib")
#pragma comment(lib, "SDLmain.lib")" @ the top, another error occurs:

1
2
3
4
5
6
7
8
9
Compiling...
main.cpp
c:\documents and settings\toby hinloopen\my documents\visual studio 2005\projects\test3\test3\main.cpp(40) : warning C4715: 'SDL_main' : not all control paths return a value
Linking...
MSVCRTD.lib(cinitexe.obj) : warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
Embedding manifest...
Build log was saved at "file://c:\Documents and Settings\Toby Hinloopen\My Documents\Visual Studio 2005\Projects\Test3\Test3\Debug\BuildLog.htm"
Test3 - 0 error(s), 2 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

after this, an error box occured:
" Unable to start program [the .exe]

This application has failed to start because the application configuration is incorrect. Review the manifest file for possible errors. Reinstalling the application may fix this problem. For more details, pls see the app. event log."


EDIT:
i did what the buildlog told me: disable the default library by adding it @ linker: ignore default library: /NODEFAULTLIB:[MSVCRTD.lib]

No compile errors, but still the " Unable to start program [the .exe]

This application has failed to start because the application configuration is incorrect. Review the manifest file for possible errors. Reinstalling the application may fix this problem. For more details, pls see the app. event log."
Last edited on Jan 5, 2009 at 12:24am
Jan 5, 2009 at 12:53am
You can safely ignore that linker warning.

The problem is most likely that you don't have the DLL, or that it's not in any of the the directories listed in the PATH environment variable. You should put it in c:\windows\system32 (or whatever it is in your system).
Topic archived. No new replies allowed.