I have been having some trouble getting my gcc and g++ compiler to work on my mac (OSX Yosemite 10.10.2).
I have written up a simple "Hello World" program and even these seem to not work. The two program that I tried to run are
hello.c
#include <stdio.h>
int main()
{
    printf("Hello world\n");
    return 0;
}
hello.cpp
#include <iostream>
int main()
{
    std::cout << "Hello World";
}
I can compile the C program using cc hello.c and everything works fine, but
when I do gcc hello.c I get this error
[1]    38508 segmentation fault  gcc hello.c
I get a similar error attempting to compile my C++ code
[1]    38596 segmentation fault  g++ hello.cpp
I did which gcc and I get /opt/local/bin/gcc and that directory is in my
path.
( /usr/texbin /opt/local/bin /opt/local/sbin /bin /usr/sbin /sbin /usr/local/bin/usr/bin )
So I am confused as to what is happening. I thought I downloaded all of the
Xcode things that I needed. I would like to get gcc and g++ running
properly. I hope that you can help.
Thanks!