Tuesday, November 27, 2012

My first C++11 program

After several attempts I've just managed to compile the last gcc version from source and to install it in my old Ubuntu.

Now I can start playing with C++11.

This is a Hello world program (that I got from here) to check that g++ is working fine:
#include <iostream>

using namespace std;

int main()
  auto func = [] () { 
    cout << "Hello world\n"; 
To compile it:
$ g++ -std=c++11 -o lambdaHello lambdaHello.cpp
And then I get my "Hello world":
$ ./lambdaHello 
Hello world

No comments:

Post a Comment