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

标签 c++ windows qt header-files

List of Errors

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

项目.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

最佳答案

C++ 307 Errors when trying to include winhttp.h in visual studio 2010基本相同, 除了使用 WinHttp 而不是 WinInet。

仍然是相同的解决方案:包括 <Windows.h> 之前 <WinInet.h> .

关于c++ - Qt <winInet.h> 在构建时输出许多 C4430 和 C2146 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45177082/

相关文章:

c++ - 使用 boost::date_time 在当前时区获取当前时间的最简单方法?

c++ - 自定义 C++ scintilla 词法分析器

c# - 窗口窗体执行批处理文件

c++ - QObject::connect:没有这样的插槽(Qt,C++)

python - 如何配置带有 Python 扩展的 Visual Studio Code 以不提示无法导入模块?

c++ - 如何找出成员函数属于哪个类

c++ - C/C++ 中的对象在程序退出后会被垃圾回收吗?

windows - 如何使用 windows Batch 存储超过 9 个参数

windows - 断言失败 - 训练 Tesseract

c++ - 如何初始化QVector