简体   繁体   中英

Error: g++.exe: No such file or directory g++.exe: fatal error: no input files in Visual studio code?

There is no error in my code, and I have configured Mingw in Environment Variables but showing this error. I've created this file in Dev C++ and is running well in it . The Error is:

g++.exe: error: Calculator: No such file or directory
g++.exe: error: .cpp: No such file or directory
g++.exe: fatal error: no input files
compilation terminated.

I have inserted the image for reference.
在此处输入图像描述

Files that I created in Visual studio code are running well and I've tried copying the code of this file in a new file and that ran. So should I do this with all the files I've created with Dev C++ or there is another method to resolve this issue?

Your problem is the filename for your source file is Calculator.cpp which contains a space. This is problematic for languages that use command line compilers like c or c++ because on the command line a space separates arguments so without quotes around the filename your compiler sees Calculator and .cpp as 2 separate files instead of Calculator.cpp .The easy fix for this is to rename the file to remove the space. I highly recommend avoiding spaces in paths or file names with c or c++ regardless of how you build to avoid issues like this.

Bro the problem is with the file name there should be no space in the file name you saved it as Calculator.cpp that's why it is showing error try saving it as Calculator.cpp

you executed the compiler, but you didn't tell it what to compile and from where to compile. Check where u have save ur program and In terminal section which shows actual directory.

The problem is with the file name. Remove the space from Calculator.cpp Even if you name your file as new code.cpp there is a possibility it will show the same error, you have to rename it to newcode.cpp

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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