I am teaching my son C++ and he wanted to look at new C++ 11 features. I compiled gcc 4.8 as g++-4.8
$ gcc-4.8
gcc-4.8: fatal error: no input files
compilation terminated.
Running a simple example fails with:
$ g++-4.8 -Wall main.cpp Jason.h Jason.cpp -o jason
main.cpp: In function ‘int main()’:
main.cpp:15:2: error: ‘Jason::Jason’ names the constructor, not the type
  Jason::Jason j1 = new Jason::Jason();
  ^
main.cpp:15:15: error: expected ‘;’ before ‘j1’
  Jason::Jason j1 = new Jason::Jason();
           ^
main.cpp:15:38: error: statement cannot resolve address of overloaded function
  Jason::Jason j1 = new Jason::Jason();
                                  ^
main.cpp:17:2: error: ‘j1’ was not declared in this scope
  j1.sayHi("Howdy");
  ^
Jason.cpp:12:19: error: expected initializer before ‘sayHi’
 void Jason::Jason sayHi(sd::string s)
I did: g++-4.8 -Wall main.cpp Jason.h Jason.cpp -o jason
main.cpp:
#include "Jason.h"
#include <iostream>
#include <string>
int main()
{
    std::cout << "Hi" << std::endl;
    std::string s = "testing";
    std::cout << "s: " << s.c_str() << std::endl;
    Jason::Jason j1 = Jason::Jason();
    j1.sayHi("Howdy");
    return 0;
}
Jason.h:
#ifndef __JASON_H__
#define __JASON_H__
#include <iostream>
#include <string>
class Jason
{
    public:
        Jason();
    virtual ~Jason();
        void sayHi(std::string s);
    protected:
        std::string hi; 
};
#endif
Jason.cpp:
#include "Jason.h"
Jason::Jason()
{
    hi = "Hello";
    std::cout << "You said Hi like: " << hi.c_str() << std::endl;   
}
void Jason::Jason sayHi(sd::string s)
{
    std::cout << "You also said hi by: " << s.c_str() << std::end;
}
I took a step back and tried with the system default gcc:
$ g++
i686-apple-darwin11-llvm-g++-4.2: no input files
$ g++ -Wall main.cpp Jason.h Jason.cpp -o jason
But I still get a single error:
Jason.cpp:12: error: expected initializer before ‘sayHi’
Can anyone help me understand why this is failing?
I tried a simple C++v11 example:
#include <iostream>
#include <thread>
//This function will be called from a thread
void call_from_thread() {
   std::cout << "Hello, World!" << std::endl;
}
int main() {
   //Launch a thread
   std::thread t1(call_from_thread);
    //Join the thread with the main thread
    t1.join();
    return 0;
}
Compiling..
$ g++-4.8 -Wall main2.cpp  -o test -std=c++11
$ ./test
Hello, World!
 
     
    