繁体   English   中英

有人可以帮我弄清楚为什么我不能通过 cmd 终端编译或使用 c++ 在 vscode 上运行构建 [重复]

[英]Can someone help me figure out why I can not compile through cmd terminal or run a build on vscode with c++ [duplicate]

尝试通过 vscode 运行构建任务时,我收到一个我不理解的错误。 我对计算机科学领域非常陌生,所有这一切都相当压倒性,所以任何帮助都将不胜感激。

任务.json 文件:

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: g++.exe build active file",
            "command": "C:\\msys64\\mingw64\\bin\\g++.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}

我收到的错误:

Starting build...
C:\msys64\mingw64\bin\g++.exe -fdiagnostics-color=always -g "C:\Users\moree\Desktop\csc 1310\lab2\DateType.cpp" -o "C:\Users\moree\Desktop\csc 1310\lab2\DateType.exe"
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o): in function `main':
C:/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crt0_c.c:18: undefined reference to `WinMain'
collect2.exe: error: ld returned 1 exit status

构建完成但出现错误。 终端进程以退出代码终止:-1。

再次,我是新人,这可能是一个简单的错误,但感谢您的帮助,谢谢。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM