2

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?

0

1 Answer 1

4

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.