How Can i Compile My C++ Project?

736 views Asked by At

it keeps telling me

gcc hello.cpp -o hello
gcc: error: hello.cpp: No such file or directory
gcc: fatal error: no input files
compilation terminated.

please anyone help

2

There are 2 answers

0
apollosoftware.org On

The source file needs to be in the same path you invoke gcc or you can put the full path in there

gcc /home/username/Desktop/hello.cpp

or you can do cd /home/username/Desktop then invoke gcc from that given path.

0
Giobunny On

set your current directory where the .cpp file is