Don Don - 5 months ago 36
C++ Question

g++ error no such file or directory

I keep getting this error when I try to compile a

file in my unix terminal.

Here is my command:

-bash-4.2$ g++ -o test.cpp test


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

But, when I type in


Do I have the wrong version of g++?


Your command line is wrong. Try this

g++ -o test test.cpp

The syntax is -o <output-file>, but you had your input file listed there, so g++ was looking for test as an input file.