Reputation: 80
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?
Upvotes: 1
Views: 45317
Reputation: 11
You executed the compiler, but you didn't tell it what to compile and from where to compile.
Check where you have saved your program and in terminal section which shows actual directory.
Upvotes: 0
Reputation: 5
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
Upvotes: 0
Reputation: 36
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
Upvotes: 1
Reputation: 10857
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.
Upvotes: 5