views:

95

answers:

3

Hello!

Do you know of any extension (desired free) for VS (or VCPP) 10 that adds C projects productivity (i.e. templates, headers control, syntax highlighting etc.)?

Thanks

+1  A: 

Visual Studio already ships with support for C. That includes project files, a compiler, header files, syntax highlighting and debugging support. What are you missing (apart from C99)?

Joey
+2  A: 
  1. Create a standard C++ project such as a Win32 Console Application (it doesn't matter which one).
  2. Add a new item (Project menu, Add New Item...) and select "C++ File (.cpp)"
  3. Here is the important step. Give the file a ".c" extension rather than a ".cpp" extension. By calling the file ".c", Visual Studio will compile it as C instead of C++.
R Samuel Klatchko
According to http://msdn.microsoft.com/en-us/library/0603949d(VS.80).aspx, I would like to add to your answer, that it is also required to wrap the stdafx.h header with 'extern "C" { /* All the includes etc. */ }'
Shimmy
@Shimmy - `extern "C"` is used for when C++ code wants to shared definitions compiled with C. If you write in pure C, you will have no need for that.
R Samuel Klatchko
A: 

Create a Win32 C++ project and from the Solution Explorer right-click your projcet and select Properties -> Configuration Properties -> C/C++ -> Advanced -> Compile As -> Compile As C., then rename the *.cpp extensions to *.c and build your project.
You may want to delete some unimportant files like stadfx.cpp and targetver.h (remove its linkage from stdafx.h).

Shimmy
Using the "compile as C" option is definitely another way to do this. But if you do that, there is no reason to rename the file to *.c.
R Samuel Klatchko
Right, the rename to *.c is just for the project to be portable and for other users to know the it's c without digging in, but for the compiler to compile as C, you have to set according to what said above, and the languages are also slightly different after all.
Shimmy