title: Compile linux gcc in windows - nvcc in windows
body: <p>here is an interesting question that, if answered positively, would make cross compiling a whole lot easier. </p>
  
  <p>Since gcc is written in C++, would it be possible to recompile the Linux gcc compiler on Windows MinGW G++ or VSC++ compiler, so that the resulting Windows executable would be able to compile c code to linux programs? </p>
  
  <p>If so, what would be needed to do that?</p>
  
  <p>So to simplify, here is what I want to do.</p>
  
  <pre><code>mingw32-g++ gcc.cpp -o gcc.exe
  </code></pre>
  
  <p>The command will probably not work because it would probably have been done before if it were that easy. What I ask is if this concept would be even possible.</p>
  
  <p><strong>Edit: thanks and expanding the question to NVCC</strong></p>
  
  <p>fvu was able to answer the question for the gcc compiler (please use the answer button next time), so if you had the same question you can thank him (or her) .</p>
  
  <p>As an extention to the question, would it be possible to edit or recompile nvcc or the things it uses so that nvcc.exe can create a linux program from CUDA C code? I read that the windows variant of nvcc can only use the Visual Studio cl.exe and not MinGW or CygWin. </p>
  
  <p>Is it possible to create linux programs with cl.exe? And if so, could that be used to generate linux programs with nvcc.exe?</p>