【发布时间】:2019-12-16 19:01:24
【问题描述】:
基本上当我点击运行错误小狗时
[运行] cd "c:\Users\alexv\Documents\Playground\" && g++ Hello_World -oc:\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:文件格式无法识别;视为链接描述文件 c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe:Hello_World:1: 语法错误 collect2.exe:错误:ld 返回 1 个退出状态
我正在使用 VSC、MinGW 和 PC,我尝试运行的程序是一个简单的 hello world:
#include <iostream>
using namespace std;
int main() {
cout << "Hello world" << endl;
return 0;
}
【问题讨论】:
-
我不是 Visual Studio Code 方面的专家,但是您可能需要展示您的
json文件。 -
g++ Hello_World: 你的源文件扩展名在哪里(例如.cpp、.cxx等)? -
我建议您使用 Visual Studio 而不是 Visual Studio Code。它更清洁且易于使用。另外,请不要使用
using namespace std;.It's considered a bad practice. -
我宁愿推荐eclipse或代码块,都和mingw一起。承认,让 IDE 运行有点麻烦,但一旦设置好,两者都运行良好。我个人认为 eclipse 尤其优于 MSVC,更重要的是隐私问题:使用 MSVC,你必须注册,所以你用你的个人数据付费,相比之下,eclipse 或 CB 是真的免费的...
标签: c++ visual-studio-code compiler-errors g++ syntax-error