LINK : fatal error LNK1561: entry point must be defined ERROR IN VC++(链接:致命错误 LNK1561:必须在 VC++ 中定义入口点错误)
问题描述
我第一次安装了 MS VS VC++,以便开始使用 GLFW 库对 OpenGL 进行编程.我在 http://shawndeprey.blogspot.com/2012/02/setting-up-glfw-in-visual-studio-2010.html然后我写了这个简单的程序,只是为了测试它,它确实在 Eclipse 上工作:
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 ==========
我知道,我在互联网上环顾四周,我找到的唯一解决方案是它需要 main()
函数才能工作".我显然有它,就在那里,但它仍然给我抛出同样的致命错误:(
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.
推荐答案
这是控制台程序项目还是 Windows 项目?我问是因为对于 Win32 和类似项目,入口点是 WinMain()
.
Is this a console program project or a Windows project? I'm asking because for a Win32 and similar project, the entry point is WinMain()
.
- 右键单击左侧的项目(而不是解决方案).
- 然后点击属性 -> 配置属性 -> 链接器 -> 系统
如果它说 Subsystem Windows
你的入口点应该是 WinMain(),即
If it says Subsystem Windows
your entry point should be WinMain(), i.e.
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd)
{
your code here ...
}
另外,说到评论.这是编译(或更准确地说是链接)错误,而不是运行时错误.当你开始调试时,编译器需要制作一个完整的程序(不仅仅是编译你的模块),这就是错误发生的时候.
Besides, speaking of the comments. This is a compile (or more precisely a Link) error, not a run-time error. When you start to debug, the compiler needs to make a complete program (not just to compile your module) and that is when the error occurs.
它甚至还没有到被加载和运行的地步.
It does not even get to the point being loaded and run.
这篇关于链接:致命错误 LNK1561:必须在 VC++ 中定义入口点错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:链接:致命错误 LNK1561:必须在 VC++ 中定义入口点错误
基础教程推荐
- 如何使图像调整大小以在 Qt 中缩放? 2021-01-01
- 为 C/C++ 中的项目的 makefile 生成依赖项 2022-01-01
- 管理共享内存应该分配多少内存?(助推) 2022-12-07
- 如何在不破坏 vtbl 的情况下做相当于 memset(this, ...) 的操作? 2022-01-01
- 从 std::cin 读取密码 2021-01-01
- 使用从字符串中提取的参数调用函数 2022-01-01
- 在 C++ 中循环遍历所有 Lua 全局变量 2021-01-01
- 为什么语句不能出现在命名空间范围内? 2021-01-01
- 如何“在 Finder 中显示"或“在资源管理器中显 2021-01-01
- Windows Media Foundation 录制音频 2021-01-01