我第一次安装了 MS VS VC++,以便开始使用 GLFW 库对 OpenGL 进行编程。我在http://shawndeprey.blogspot.com/2012/02/setting-up-glfw-in-visual-studio-2010.html遵循有关如何安装它的说明 然后我编写了这个简单的程序,只是为了测试它,它确实在 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;
}
但后来我得到了这个可怕的错误:
------ 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 ==========
我知道,我在互联网上环顾四周,发现的唯一解决方案是“它需要main()
功能才能工作”。我显然有它,就在那里,但它仍然给我同样的致命错误:(
很高兴得到有关如何解决它的回应。安装过程中可能存在缺陷或其他问题。