web.onassar.com Archive

I can be reached at onassar@gmail.com.

For my open source work, check out github.com/onassar

c++ Hello World in Ubuntu 10.10 (Maverick Meerkat)

View more posts

Wanting to get into c++/openFrameworks, and thought the first to do would be to brush up on my c++. It's been 7 or 8 years since I touched it, so the following is the simplest hello world I could get working.

I'm running this on Ubuntu 10.10 and have g++ installed.

I created HelloWorld.C with the following code:

using namespace std;

int main ()
    cout << "Hello World!";
    return 0;

I'd assume that it could be done more efficiently by having a void main declared, but apparently main must always be declared to return a value which is an int.

Anyway, to compile the above code, run the following:

g++ HelloWorld.C

This create's an a.out file. Just run the following command for Hello World goodness: