Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/visual-studio-2010/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio 2010 使用WinInet.h时出现未解决的错误(…错误LNK2019:未解决的外部符号_WinMain@16....)_Visual Studio 2010_Wininet_Lnk2019 - Fatal编程技术网

Visual studio 2010 使用WinInet.h时出现未解决的错误(…错误LNK2019:未解决的外部符号_WinMain@16....)

Visual studio 2010 使用WinInet.h时出现未解决的错误(…错误LNK2019:未解决的外部符号_WinMain@16....),visual-studio-2010,wininet,lnk2019,Visual Studio 2010,Wininet,Lnk2019,我是编程新手。我在运行程序时不断遇到此错误。我已经在网上查过了,很多人建议在所有包含之后添加/*#pragma comment(lib,“wininet.lib”)*/或者更改属性设置 到目前为止,我已经改变了这两个方面,但信息仍然存在 我正在使用2010 Microsoft Visual Studio,整个错误消息如下: 1> MSVCRTD.lib(crtexew.obj):错误LNK2019:未解析的外部符号WinMain@16引用>在函数中\uu tmainCRTStartup 1> C

我是编程新手。我在运行程序时不断遇到此错误。我已经在网上查过了,很多人建议在所有包含之后添加/*#pragma comment(lib,“wininet.lib”)*/或者更改属性设置
到目前为止,我已经改变了这两个方面,但信息仍然存在
我正在使用2010 Microsoft Visual Studio,整个错误消息如下:

1> MSVCRTD.lib(crtexew.obj):错误LNK2019:未解析的外部符号WinMain@16引用>在函数中\uu tmainCRTStartup
1> C:\Users\Username\Desktop\Winlnet test\Debug\Winlnet test.exe:致命错误LNK1120:1>未解析的外部
1>
1> 生成失败。
1>

非常感谢您的帮助!!下面是节目

#include <string>
#include <iostream>
#include <fstream>
#include <windows.h>
#include <wininet.h>
#include <winsock.h>
#include <stdio.h>
#include <stdarg.h>

#pragma comment(lib, "wininet.lib")

using namespace std;

int main()      
{
HINTERNET hOpen, hURL;
LPCWSTR NameProgram = L"Webreader";             //      LPCWSTR == Long Pointer to Const Wide String 
LPCWSTR Website;                    
char file[101];
unsigned long read;

//Always need to establish the internet connection with this funcion.  
  if ( !(hOpen = InternetOpen(NameProgram, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0 )))
    {
    cerr << "Error in opening internet" << endl;
    return 0;
    }                       
Website = L"http://www.google.com";
hURL = InternetOpenUrl( hOpen, Website, NULL, 0, 0, 0 );            //Need to open the URL


InternetReadFile(hURL, file, 100, &read);
while (read == 100)
    {
    InternetReadFile(hURL, file, 100, &read);
    file[read] = '\0';
    cout << file;
    }

cout << endl;
InternetCloseHandle(hURL);
return 0;
}
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#pragma注释(lib,“wininet.lib”)
使用名称空间std;
int main()
{
腹地霍本,投掷;
LPCWSTR NameProgram=L“Webreader”;//LPCWSTR==指向常量宽字符串的长指针
LPCWSTR网站;
字符文件[101];
无符号长读;
//始终需要使用此功能建立internet连接。
if(!(hOpen=InternetOpen(名称程序、INTERNET\u打开\u类型\u预配置、NULL、NULL、0)))
{

cerr您没有
WinMain()
函数。与
wininet
无关。请您进一步解释一下好吗?非常感谢!!您似乎选择了Windows应用程序而不是控制台应用程序。在前者中,您的入口点称为
WinMain()
并且没有为您生成控制台窗口。因此您很可能需要将您的项目设置为控制台应用程序。@Aneri非常感谢!!这是一个巨大的帮助!@Aneri很抱歉打断您!我是一个非常初学者,您能帮我解释一下区别吗?windows应用程序和控制台应用程序。非常感谢!!