Drake Daniels
Drake Daniels

Reputation: 71

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.

$ 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?

Upvotes: 2

Views: 70

Answers (1)

John Kugelman
John Kugelman

Reputation: 362007

In fact, it did compile successfully. Following a common Linux convention, g++ doesn't print anything when it succeeds. 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

Upvotes: 4

Related Questions