Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/137.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么我的代码没有在终端中输出任何东西。开始一个新行没有错误 这是C++文件中的代码: #include <iostream> using namespace std; int main() { cout << "Hello World" << endl; return 0; } #包括 使用名称空间std; int main() { cout_C++_Linux_Terminal_Clang++ - Fatal编程技术网

为什么我的代码没有在终端中输出任何东西。开始一个新行没有错误 这是C++文件中的代码: #include <iostream> using namespace std; int main() { cout << "Hello World" << endl; return 0; } #包括 使用名称空间std; int main() { cout

为什么我的代码没有在终端中输出任何东西。开始一个新行没有错误 这是C++文件中的代码: #include <iostream> using namespace std; int main() { cout << "Hello World" << endl; return 0; } #包括 使用名称空间std; int main() { cout,c++,linux,terminal,clang++,C++,Linux,Terminal,Clang++,正如你所说,clang++是编译器,也就是说,它将代码转换成可以执行的二进制文件,而不是程序本身 默认情况下,编译后的文件名为a.out,因此编译后,要执行程序,应运行: ./a.out 您可以这样指定输出文件名: clang++ infile.cpp -o outfile 然后运行二进制文件: ./outfile

正如你所说,clang++是编译器,也就是说,它将代码转换成可以执行的二进制文件,而不是程序本身

默认情况下,编译后的文件名为
a.out
,因此编译后,要执行程序,应运行:

./a.out

您可以这样指定输出文件名:

clang++ infile.cpp -o outfile
然后运行二进制文件:

./outfile