Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I want to compile this code:

#include <SDL.h>

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

But it can't be linked: Error 1 error LNK1561: entry point must be defined

There is some strange code in this library: http://hg.libsdl.org/SDL/file/75726efbf679/include/SDL_main.h

#define main    SDL_main

Also I added SDL2.lib;SDL2main.lib to Project Settings => Linker => Input.

What can I do to run this project?
VS 2012 SP3, empty C++ project.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
357 views
Welcome To Ask or Share your Answers For Others

1 Answer

According to this thread on Dream.In.Code:

Right click on project name -> Properties -> Expand Linker tab -> System -> SubSystem: make sure that it is Console (/SUBSYSTEM:CONSOLE)

Alternatively, if you want to hide the console window or are debugging a multithreaded application, you should set the SubSystem to Window (/SUBSYSTEM:WINDOW) instead.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...