title: MacOS "configure: error: cannot run C compiled programs"
body: <p>I am pretty new to the MacOS environment and I previously had some issue compiling C scripts. I had the following issue: </p>
  
  <pre><code>fatal error: stdio.h: No such file or directory
   #include &lt;stdio.h&gt;
                     ^
  compilation terminated.
  </code></pre>
  
  <p>I tried to re-install <code>xcode-select --install</code> but keep telling me </p>
  
  <blockquote>
    <p>xcode-select: error: command line tools are already installed, use "Software Update" to install updates</p>
  </blockquote>
  
  <p>I updated everything and nothing.  Apparently it is because I don't have the <code>/usr/includes</code> file. I found a way to compile my software by using </p>
  
  <p><code>/Library/Developer/CommandLineTools/usr/bin/g++ XXXX.cpp</code></p>
  
  <p>However, now I am trying to <code>./compile</code> and <code>make</code> another software but I don't know how to use this gcc interpreter by default. When I try to ./configure I got this error </p>
  
  <blockquote>
    <p>configure: error: cannot run C compiled programs. If you meant to
    cross compile, use  '--host'. See 'config.log' for more details</p>
  </blockquote>
  
  <p>So when I do look into <code>config.log</code> :</p>
  
  <pre><code>configure:3224: checking for gcc
  configure:3240: found /usr/local/bin/gcc
  configure:3251: result: gcc
  configure:3282: checking for C compiler version
  configure:3291: gcc --version &gt;&amp;5
  gcc (GCC) 4.9.2 20141029 (prerelease)
  Copyright (C) 2014 Free Software Foundation, Inc.
  This is free software; see the source for copying conditions.  There is NO
  warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  
  configure:3302: $? = 0
  configure:3291: gcc -v &gt;&amp;5
  Using built-in specs.
  COLLECT_GCC=gcc
  COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-apple-darwin14.0.0/4.9.2/lto-wrapper
  Target: x86_64-apple-darwin14.0.0
  Configured with: ../gcc-4.9-20141029/configure --enable-languages=c++,fortran
  Thread model: posix
  gcc version 4.9.2 20141029 (prerelease) (GCC) 
  configure:3302: $? = 0
  configure:3291: gcc -V &gt;&amp;5
  gcc: error: unrecognized command line option '-V'
  gcc: fatal error: no input files
  compilation terminated.
  configure:3302: $? = 1
  configure:3291: gcc -qversion &gt;&amp;5
  gcc: error: unrecognized command line option '-qversion'
  gcc: fatal error: no input files
  compilation terminated.
  configure:3302: $? = 1
  configure:3322: checking whether the C compiler works
  configure:3344: gcc    conftest.c  &gt;&amp;5
  configure:3348: $? = 0
  configure:3396: result: yes
  configure:3399: checking for C compiler default output file name
  configure:3401: result: a.out
  configure:3407: checking for suffix of executables
  configure:3414: gcc -o conftest    conftest.c  &gt;&amp;5
  configure:3418: $? = 0
  configure:3440: result: 
  configure:3462: checking whether we are cross compiling
  configure:3470: gcc -o conftest    conftest.c  &gt;&amp;5
  conftest.c:15:19: fatal error: stdio.h: No such file or directory
   #include &lt;stdio.h&gt;
                     ^
  compilation terminated.
  configure:3474: $? = 1
  configure:3481: ./conftest
  ./configure: line 3483: ./conftest: No such file or directory
  configure:3485: $? = 127
  configure:3492: error: in `/Users/XXXX/phyml':
  configure:3494: error: cannot run C compiled programs.
  If you meant to cross compile, use `--host'.
  See `config.log' for more details
  </code></pre>
  
  <p>Do you have any ideas of how I can fix it ? </p>
  
  <p>Thanks a lot !</p>