LINK : fatal error LNK1561: entry point must be de

2019-01-22 18:10发布

I installed MS VS VC++ for the first time in order to start programming OpenGL with GLFW library. I follower instructions on how to install it over at http://shawndeprey.blogspot.com/2012/02/setting-up-glfw-in-visual-studio-2010.html Then I wrote this simple program, just to test it, which did work on Eclipse:

#include <stdlib.h>
#include <GL/glfw.h>

using namespace std;

int main()
{
    int running = GL_TRUE;
    if (!glfwInit()) {
        exit(EXIT_FAILURE);
    }

    if (!glfwOpenWindow(300, 300, 0, 0, 0, 0, 0, 0, GLFW_WINDOW)) {
        glfwTerminate();
        exit(EXIT_FAILURE);
    }

    while (running) {
        // glClear( GL_COLOR_BUFFER_BIT );
        glfwSwapBuffers();
        running = !glfwGetKey(GLFW_KEY_ESC) && glfwGetWindowParam(GLFW_OPENED);
    }

    glfwTerminate();
    exit(EXIT_SUCCESS);
    return 0;
}

But then I got this awful error:

------ Build started: Project: first1, Configuration: Debug Win32 ------
   LINK : fatal error LNK1561: entry point must be defined
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I know, I've looked around on the internet and the only solution I found was "It requires main() function in order to work". I obviously have it, right there, but it still throws me the same fatal error :(

Would be great to get response on how to fix it. There might me a flaw in the installation process or something.

9条回答
手持菜刀,她持情操
2楼-- · 2019-01-22 18:41

If someone got problems with this still, i myself got one empty .cpp file in another project even (but in same solution) and just gave it a simple main with return 0; and then worked alright.

查看更多
Luminary・发光体
3楼-- · 2019-01-22 18:44

change it to Console (/SUBSYSTEM:CONSOLE) it will work

查看更多
狗以群分
4楼-- · 2019-01-22 18:45

You can get this error if you define a project as an .exe but intent to create a .lib or a .dll

查看更多
登录 后发表回答