0

VS Code バージョン 1.62.0 を使用しています (ユーザー設定)

C (test.c) で基本的なプログラムを実行しようとしています:

#include <stdio.h>
#include <stdlib.h>

int main() {
    printf("Hello");
    return 0;
}

Play Sign (CTRL+ALT+N) をクリックして実行しようとしていますが、ターミナルでは次のようになります。

PS C:\Users\X\Dropbox\My PC_X\Downloads> cd "c:\Users\X\Dropbox\My PC_X\Downloads\est\" ; if ($?) { g++ test.c *.c  -o test } ; if ($?) { .\test }
C:\Users\X\AppData\Local\Temp\ccyBS6yO.o:test.c:(.text+0x0): multiple definition of `main'
C:\Users\X\AppData\Local\Temp\ccwvYj0K.o:test.c:(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status

この情報が役立つかどうかはわかりません。参考までに、私はWindows 11を使用しています(私の場合、これは本当に壊れていると思います)。以前は、[デスクトップ、ドキュメント、画像] を OneDrive と同期していました (OneDrive がローカル フォルダーになります)。しかし、2 日前に、ドキュメントの同期をオフにし、一部のドキュメントは完全に OneDrive に保存されます (必ずしもローカル フォルダーにあるとは限りません) [より明確にするために、写真を見てください]

壊れた Windows 11

これが私のgccバージョンです:

gcc.exe (MinGW.org GCC-6.3.0-1) 6.3.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

ここに私の task.json があります:

{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: gcc.exe build active file",
            "command": "C:\\MinGW\\bin\\gcc.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": "build",
            "detail": "compiler: C:\\MinGW\\bin\\gcc.exe"
        }
    ]
}
4

2 に答える 2