小编Des*_*cie的帖子

Windows.h 导致 C++ 类出现问题

我使用的是 Visual Studio 2019,当我用 C++ 编写第一堂课时,发生了错误。当我删除它时它消失了#include <Windows.h>。我的问题是,为什么Windows.h会与 C++ 类发生冲突,是否可以同时使用两者(我几乎可以肯定)。

#include <iostream>
#include <locale>
using std::cout;
using std::cin;

class Rectangle {
public:
    Rectangle() = default;

    Rectangle(double width, double height)
        : width_{ width }, height_{ height }
    {}
    double Width() const { return width_; }
    double Height() const { return height_; }

    double Area() const {
        return width_ * height_;
    }
    double Perimeter() const {
        return 2 * (width_ + height_);
    }
    void Scale(double scaleFactor) {
        width_ *= …
Run Code Online (Sandbox Code Playgroud)

c++ windows c++11 visual-studio-2019

2
推荐指数
1
解决办法
139
查看次数

标签 统计

c++ ×1

c++11 ×1

visual-studio-2019 ×1

windows ×1