. Advertisement .
..3..
. Advertisement .
..4..
I get the “entry point must be defined c++” error as the title says. How can I fix it so the error goes away? Here is my detail:
#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;
}
When I operated it, I received the error text:
------ 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 appreciate any help from you.
The cause:
The error happens while you are attempting to construct the code. The VS linker cannot detect the function of the entry point in your code, so it can’t call your code. Besides, it isn’t a run-time error, it’s a compilation error or more accurately it’s a link. When you begin debugging, the compiler must create a complete program (rather than just build your module), the issue occurs in this case.
Solution:
To solve this problem, you must create an Entry Point by adding ‘Main’ ( it’s an empty area before it’s edited). Let’s look at below suggestion:
If you do as my suggestion, your error will disappear.
This is a Windows or console program project. Because
WinMain()
is the entry point for Win32 or similar projects, I am asking.If
Subsystem Windows
is displayed, your entry point should be WinMain().Also, let’s not forget the comments. This is a compile error (or more accurately a Link error), and not a runtime error. The compiler must make a complete program in order to debug the problem. This is not a compilation error.
It doesn’t even get to the point of being loaded and run.