[英]g++ error no such file or directory
I keep getting this error when I try to compile a .cpp
file in my unix terminal. 当我尝试在unix终端中编译
.cpp
文件时,我一直收到此错误。
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
: 但是,当我输入
ls
:
test.cpp
Do I have the wrong version of g++? 我的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. 语法为
-o <output-file>
,但是您的输入文件在此处列出,因此g ++一直在寻找test
作为输入文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.