Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/141.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++ Ubuntu Linux的编译问题_C++_Linux - Fatal编程技术网

C++ Ubuntu Linux的编译问题

C++ Ubuntu Linux的编译问题,c++,linux,C++,Linux,第一次使用Ubunutu PuTTY Linux SSH客户端时,我不确定为什么无法成功编译代码 $ cat helloworld.cc #include <iostream> using std::cout; using std::endl; int main(int argc, char *argv[]) { cout << "Hello world!" << endl; return 0; } $ g++ helloworld.cc

第一次使用Ubunutu PuTTY Linux SSH客户端时,我不确定为什么无法成功编译代码

$ cat helloworld.cc
#include <iostream>

using std::cout;
using std::endl;

int main(int argc, char *argv[])
{
    cout << "Hello world!" << endl;
    return 0;
}

$ g++ helloworld.cc -o helloworld
$ 
$cat helloworld.cc
#包括
使用std::cout;
使用std::endl;
int main(int argc,char*argv[])
{

cout事实上,它确实成功地编译了。按照常见的Linux约定,g++在成功时不会打印任何东西。它只会在出现问题时打印错误消息。缺少输出意味着它工作了。这可能看起来很奇怪,但一旦你习惯了它,它实际上就很好了,因为它意味着屏幕上没有无用的“它工作了!”信息

您可以运行通过键入以下内容创建的
helloworld
可执行文件:

$ ./helloworld