"STD_OUTPUT_HANDLE" 标识符的第一个实例未定义

First Instance of "STD_OUTPUT_HANDLE" Identifier is Undefined

我使用的是 Visual Studio 2019,我的代码使用经常更改颜色的控制台输出。我在我的代码中包含 Windows.h,这是包含 SetConsoleTextAttributes 的头文件,而 STD_OUTPUT_HANDLE 应该由 using namespace std 初始化。我的完整代码可以找到here,但以下是错误的部分:

#include <iostream>
#include <cmath>
#include "HeadFile.h"
#include <windows.h>
#include <string.h>

using namespace std;

int Play(char(&spaces)[7][6], int(&color)[7][6], int player, int playerOneWins, int playerTwoWins, int ties)
{
    HANDLE hConsole;
    hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
.....

代码运行良好,但在工作室内部,我看到以下错误:

错误来自 第一个实例 STD_OUTPUT_HANDLE (图片底部的另一种情况没有错误)。如果我注释掉第一个,下一个实例错误:

我该如何解决这个问题?我在一些不相关的帖子中读到 using namespace std 有时会导致问题。是这样吗?

使用头文件 "Windows.h" 而不是 "windows.h"。