Reputation: 13
I keep getting this error when I try to compile a .cpp
file in my unix terminal.
Here is my command:
-bash-4.2$ g++ -o test.cpp test
Output:
g++: error: test: No such file or directory
g++: fatal error: no input files
compilation terminated.
But, when I type in ls
:
test.cpp
Do I have the wrong version of g++?
Upvotes: 0
Views: 13217
Reputation: 137557
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.
Upvotes: 4