Thursday, February 18, 2010

Compiling C code using Visual Studio .Net

This applies to older version of Visual Studio .Net (before 2008) as well but I haven't tested.

I recently got some code in C that needed to be setup in a visual studio project. Its not hard but I thought I'd still share the information:

  • Start with a new project. 
  • Select Visual C++ "Win32 Console Application".
  • Check the  "Empy Project" in Application Settings along with leaving the default radio "Console Application" checked
  • Add your files to the newly created project
  • Select "Project Properties -> c/c++ -> Advanced" and set the option "Compile As" to "Compile as C Code" (/TC) 
  • Click OK
All set :) Just Build (Ctrl+Shift+B)