Qt <winInet.h> 在构建时输出许多 C4430 和 C2146 错误

Qt <winInet.h> outputs many C4430 & C2146 Errors on build

本文关键字:许多 输出 C4430 C2146 错误 winInet lt gt Qt 构建      更新时间:2023-10-16

错误列表

我想我已经在这里的QT项目文件中包含了winInet.h的库:

project.pro

QT += qml quick network
CONFIG += c++11
SOURCES += main.cpp 
xmap.cpp
RESOURCES += qml.qrc
LIBS += -lwininet

每次我尝试 qmake 并构建头文件时都会显示许多语法错误,我很好奇这是否因为我的 qt 项目文件语法错误。

xmap.h

#ifndef XMAP_H
#define XMAP_H
#include <iostream>
#include <WinInet.h>    // <--- ISSUE
#include <Windows.h>
#include <time.h>
class xmap
{
public:
xmap();
// test connection to websites for data
int CheckConnection(int connection = 0);
// pull data from online sources to be evaluated by the model
void RequestAndSaveData(std::string filename);

};
#endif // XMAP_H

在Visual Studio 2010中尝试包含winhttp.h时C++与307错误基本相同,只是使用WinHttp而不是WinInet。

不过,相同的解决方案:在<WinInet.h>之前包括<Windows.h>