Segmentation violation when compiling stand alone

You have to generate a dictionary for your MyMainFrame class with rootcling, and add the generated source file to your project
And see also tips for efficient and successful posting