c++ 尝试使用g++在VSCode中编译代码并获得错误[关闭]

5cg8jx4n  于 4个月前  发布在  Vscode
关注(0)|答案(1)|浏览(92)

**已关闭。**此问题为not reproducible or was caused by typos。目前不接受回答。

这个问题是由错字或无法再重现的问题引起的。虽然类似的问题在这里可能是on-topic,但这个问题的解决方式不太可能帮助未来的读者。
7天前关闭
Improve this question
下面是一个例子:

#include <iostream>
using namespace std;
int main()
{
  cout << "Hello world!" << endl;
  return 0;
}

字符串
以下是我在终端中得到的:

*  Executing task: C/C++: g++.exe build active file 
Starting build...
C:\mingw64\bin\g++.exe -fdiagnostics-color=always -g C:\Users\Mohamed's PC\Desktop\CodeBlocks\file\main.cpp -o C:\Users\Mohamed's PC\Desktop\CodeBlocks\file\main.exe
cc1plus.exe: fatal error: PC\Desktop\CodeBlocks\file\main.cpp: No such file or directory
compilation terminated.

Build finished with error(s).

 *  The terminal process failed to launch (exit code: -1). 
 *  Terminal will be reused by tasks, press any key to close it.


error in a screenshot
尝试在youtube上用各种不同的方法安装mingw64,即使编译器工作,它也只是运行由coderunner扩展创建的exe文件,不能自己创建新的exe文件。

6bc51xsx

6bc51xsx1#

把路径用“”包起来,因为路径中有空格。所以我们用“”或“”来转义任何特殊字符,这样就可以了。

C:\mingw64\bin\g++.exe -fdiagnostics-color=always -g "C:\Users\Mohamed's PC\Desktop\CodeBlocks\file\main.cpp" -o "C:\Users\Mohamed's PC\Desktop\CodeBlocks\file\main.exe"

字符串

相关问题