Visual Studio 2019中的一个简单tic tac toe程序会导致Windows Defender报告威胁 使用微软Visual Studio 2019创建一个新的C++控制台应用程序。 添加一个文件,命名为tictactoe.c。 粘贴下面给出的代码- #include <stdio.h> int main(void) { int player = 0; int winner = 0; char board[3][3] = { {'1','2','3'}, {'4','5','6'}, {'7','8','9'} }; //The main game loop. The game continues for up to 9 turns. for (unsigned i = 0; i < 9 && winner == 0; ++i) { //Display the board printf("\n"); printf(" %c | %c | %c \n", board[0][0], board[0][1], board[0][2]); printf("-----+-----+-----\n"); printf(" %c | %c | %c\n", board[1][0], board[1][1], board[1][2]); printf("-----+-----+-----\n"); printf(" %c | %c | %c\n", board[2][0], board[2][1], board[2][2]); player = i % 2 + 1; } return 0; } #包括 内部主(空) { int-player=0; int=0; 字符板[3][3]={ {'1','2','3'}, {'4','5','6'}, {'7','8','9'} }; //游戏主循环。游戏最多持续9圈。 for(无符号i=0;i

Visual Studio 2019中的一个简单tic tac toe程序会导致Windows Defender报告威胁 使用微软Visual Studio 2019创建一个新的C++控制台应用程序。 添加一个文件,命名为tictactoe.c。 粘贴下面给出的代码- #include <stdio.h> int main(void) { int player = 0; int winner = 0; char board[3][3] = { {'1','2','3'}, {'4','5','6'}, {'7','8','9'} }; //The main game loop. The game continues for up to 9 turns. for (unsigned i = 0; i < 9 && winner == 0; ++i) { //Display the board printf("\n"); printf(" %c | %c | %c \n", board[0][0], board[0][1], board[0][2]); printf("-----+-----+-----\n"); printf(" %c | %c | %c\n", board[1][0], board[1][1], board[1][2]); printf("-----+-----+-----\n"); printf(" %c | %c | %c\n", board[2][0], board[2][1], board[2][2]); player = i % 2 + 1; } return 0; } #包括 内部主(空) { int-player=0; int=0; 字符板[3][3]={ {'1','2','3'}, {'4','5','6'}, {'7','8','9'} }; //游戏主循环。游戏最多持续9圈。 for(无符号i=0;i,c++,c,visual-studio-2019,C++,C,Visual Studio 2019,构建它,然后运行它。 出于某种原因,Windows defender认为它已检测到威胁!!! 您的代码看起来很正常。我认为Windows Defender出现问题是因为检测到假阳性。我在MSVC2019上查看了它-第二次运行的结果相同(第一次运行有效)。 让我们在Microsoft支持论坛上问这个问题?这似乎是Windows defender的误报。 类似的问题也发生在其他编译器上,比如MinGW。有关一个此类实例,请参阅 规避此问题的方法是在Windows控制面板的“病毒和威胁保护”页面的Wi

构建它,然后运行它。 出于某种原因,Windows defender认为它已检测到威胁!!!
您的代码看起来很正常。我认为Windows Defender出现问题是因为检测到假阳性。我在MSVC2019上查看了它-第二次运行的结果相同(第一次运行有效)。
让我们在Microsoft支持论坛上问这个问题?

这似乎是Windows defender的误报。 类似的问题也发生在其他编译器上,比如MinGW。有关一个此类实例,请参阅

规避此问题的方法是在Windows控制面板的“病毒和威胁保护”页面的Windows“允许的威胁”窗口中将二进制文件标记为异常。请参阅下面的屏幕抓图(假设为Windows 10)