这是我第一次编程,我不会 运行 我的代码

This is my first time programming and i cant run my code

基本上当我点击 运行 时会弹出一个错误

[Running] cd "c:\Users\alexv\Documents\Playground\" && g++ Hello_World -o c:\Users\alexv\Documents\Playground\Hello_World && "c:\Users\alexv\Documents\Playground\"c:\Users\alexv\Documents\Playground\Hello_World c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe:Hello_World: file format not recognized; treating as linker script c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe:Hello_World:1: syntax error collect2.exe: error: ld returned 1 exit status

我正在使用 VSC、MinGW 和一台 PC,我正在尝试 运行 的程序是一个简单的 hello world:

#include <iostream>

using namespace std;

int main() {
    cout << "Hello world" << endl;

    return 0;
}

如评论中所述,错误信息比较清楚

g++ 接受几种不同类型的文件作为参数。它试图通过查看文件扩展名来确定您正在处理的文件类型。

您的文件没有扩展名,因此 g++ 默认假定它是一个链接描述文件,但它确实是一个 C++ 源文件。

为 C++ 源文件使用一种常见的文件扩展名,g++ 将在没有其他选项的情况下正确处理文件。常见的 C++ 源文件扩展名是 .cpp.cc.cxx.