我正在尝试将 VScode 设置为能够使用 Code Runner 包为 C 和 C++ 代码设置“Code Runner”包,但它总是会出错:
[Running] cd "d:\Desktop\Programming\For_fun\tester\" && g++ practice.cpp -o practice && "d:\Desktop\Programming\For_fun\tester\"practice
[Done] exited with code=1 in 0.123 seconds
我发现使用 wsl 和 ubuntu 进行编译和运行是可行的,但常规的命令提示符则不行。我认为这是问题所在的一个重要指标,但我不知道如何解决它,甚至不知道如何开始使用谷歌搜索。
我使用的是 Windows 10
这是我的代码:
#include <vector>
#include <iostream>
#include <string>
using namespace std;
int main() {
cout << "Hello World!\n";
return 0;
}
这是我尝试确认是否安装了相关软件包的结果:
PS D:\Desktop\Programming\For_fun\tester> c++ --version
c++.exe (MinGW.org GCC Build-20200227-1) 9.2.0
Copyright (C) 2019 Free Software Foundation,Inc.
warranty; not even for MERCHANTABILITY or fitness FOR A PARTICULAR PURPOSE.
PS D:\Desktop\Programming\For_fun\tester> gcc --version
gcc.exe (Rev5,Built by MSYS2 project) 10.3.0
Copyright (C) 2020 Free Software Foundation,Inc.
PS D:\Desktop\Programming\For_fun\tester> g++ --version
g++.exe (MinGW.org GCC Build-20200227-1) 9.2.0
Copyright (C) 2019 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.
warranty; not even for MERCHANTABILITY or fitness FOR A PARTICULAR PURPOSE.
谢谢!