C++ 致命错误 LNK1120:1 个未解析的外部

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6515271/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 20:18:09  来源:igfitidea点击:

fatal error LNK1120: 1 unresolved externals

c++windowsvisual-c++graphics

提问by saplingPro

This is the program :

这是程序:

#include <windows.h>

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                PSTR szCmdLine, int iCmdShow)
{
 MessageBox (NULL, TEXT ("Hello, Windows!"), TEXT ("HelloMsg"), 0) ;

 return 0 ;
}

I can't understand the error.Please help in correcting it.

我无法理解错误。请帮助更正。

**ERROR** `fatal error LNK1120: 1 unresolved externals

回答by Suhail Gupta

I think you might be working on a console projectand trying to make a windows application! If it is so,select a new win32 project from file->newand then re-write that code. You will have this as output:

我想你可能正在研究 aconsole project并试图制作一个windows application! 如果是这样,请从中选择一个新的 win32 项目file->new,然后重新编写该代码。 你将把它作为输出:

enter image description here

在此处输入图片说明

回答by Martyn Lovell

Add user32.lib to your link libraries list.

将 user32.lib 添加到您的链接库列表中。

Martyn

马丁

回答by Nocturnal

I don't think they include the Windows SDK part of the VS Express Installation.

我认为它们不包括 VS Express 安装的 Windows SDK 部分。

VS Express = stripped down version of the Commercial VS

VS Express = 商业 VS 的精简版

Downloader http://www.microsoft.com/download/en/details.aspx?displaylang=en%29&id=3138

下载器 http://www.microsoft.com/download/en/details.aspx?displaylang=en%29&id=3138

ISO http://www.microsoft.com/download/en/details.aspx?id=18950

ISO http://www.microsoft.com/download/en/details.aspx?id=18950

I recommend the ISO it's a good way of keeping a backup copy around.

我推荐 ISO,这是一种保存备份副本的好方法。