【问题标题】:A simple tic-tac-toe program in Visual Studio 2019 causes Windows Defender to report threatVisual Studio 2019 中的一个简单井字游戏程序导致 Windows Defender 报告威胁
【发布时间】:2020-10-28 11:39:18
【问题描述】:

使用 Microsoft 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;
}

构建它,然后运行它。 出于某种原因,Windows Defender 认为它检测到了威胁!!!

【问题讨论】:

    标签: c++ c visual-studio-2019


    【解决方案1】:

    您的代码看起来很正常。我认为 Windows Defender 存在误报检测问题。我在我的 MSVC2019 上查看了它 - 第二次运行的结果相同(第一次运行有效)。 让我们在 Microsoft 支持论坛上问这个问题?

    【讨论】:

      【解决方案2】:

      这似乎是来自 Windows Defender 的误报。 其他编译器(如 MinGW)也出现了类似的问题。请参阅Code::Blocks MinGW Windows Defender Trojan:Win32/Fuery.C!cl 了解此类实例。

      避免这种情况的方法是在 Windows 控制面板的“病毒和威胁防护”页面中的 Windows“允许的威胁”窗口中将二进制文件标记为异常。请参阅下面的屏幕截图(假设为 Windows 10)。

      【讨论】:

        猜你喜欢
        • 2019-12-07
        • 2021-02-23
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-12-02
        • 2015-01-30
        相关资源
        最近更新 更多