Click here to Skip to main content
16,019,589 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
when i am trying to compile my Code in c++ using the g++ compiler(suing linxu mint)
by the command g++ A.cpp
i get the response :
g++: error: A.cpp: No such file or directory
g++: fatal error: no input files
compilation terminated.


What I have tried:

what is should do at that case
Posted
Updated 9-Sep-22 3:03am

The error is clear: the C++ compiler (g++) cannot find your source file (A.cpp). Just make sure you are running g++ in the same folder wherein is your source file (alternatively you may pass the full path of your source file to g++).
 
Share this answer
 
Comments
Ahmad Qassym 21-May-20 9:20am    
i am beginner in linux and c++.
can u tell me how can i solve that problem literally ?
g++ is unable to locate the file A.cpp. Is that file in your current directory? Is it perhaps a.cpp or A.CPP? Do ls in your current working directory and see.
 
Share this answer
 
Comments
Ahmad Qassym 18-May-20 10:15am    
how can i make ls in my current directory ?
k5054 18-May-20 11:18am    
That depends. How did you create the file to begin with? Did you use an IDE? If you did, then the IDE should be able to compile the project without you having to go to the command line. If you used an editor, e.g. nano or vi, from the command line, then when you saved the file, it should be in the same directory. If you launched an editor like gedit from the start menu, then when you selected "Save", it should ask you where you want to save it. Maybe you saved to Documents/A.cpp?
Ahmad Qassym 18-May-20 11:49am    
actully i use the vim editor and opened the terminal directly and wrote
'vim A.cpp'( without the quotationmark)
k5054 18-May-20 11:57am    
Did you save it? :wq or ZZ to close and save. You should have an A.cpp in the directory you are currently in unless you do not have write permission to the directory and then vim should say Can't open file for writing
Take the compiler messages serious: it is your best friend in programming. ;-)

Your A.cpp file is missing. Maybe you have moved, deleted or renamed it. So you need to change your project settings or make file or restore from your trashbin.

PS: naming a file "A" isnt a good idea. It is better to use long and "speaking" names.

Toi besrrious about it: FOR EVERYTHING AND FOREVER.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900