简体   繁体   English

Ubuntu Linux的编译问题

[英]Compiling issue with Ubuntu Linux

First time using the Ubunutu PuTTY Linux SSH client, I am unsure of why I am unable to successfully compile the code. 第一次使用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
$ 

The result I get is, from the last line, that it asks me to input another code, without any result or error from the compiler. 从最后一行得到的结果是,它要求我输入另一个代码,而编译器没有任何结果或错误。 Does anybody know what I need to change? 有人知道我需要更改吗?

In fact, it did compile successfully. 实际上,它确实编译成功。 Following a common Linux convention, g++ doesn't print anything when it succeeds. 按照通用的Linux约定,g ++成功时不会打印任何内容。 It only prints error messages if there's a problem. 仅在出现问题时才打印错误消息。 A lack of output means it worked. 缺乏输出意味着它有效。 It may seem strange, but once you get used to it it's actually nice because it means the screen isn't littered with useless "it worked!" 看起来似乎很奇怪,但是一旦习惯了它,实际上就很好了,因为这意味着屏幕上不会乱满无用的“它起作用了!” messages. 消息。

You can run the helloworld executable it created by typing: 您可以通过键入以下命令运行它创建的helloworld可执行文件:

$ ./helloworld

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM