Adding standard C "template".  
Author Message
Casper.ptrsn





PostPosted: Visual C++ Express Edition, Adding standard C "template". Top

My intention to use Visual Studio Express C++ was to have an good and stable compiler and IDE to develop C (ANSI C) code on a windows platform.

I know that the program title suggests other use for it than for standard C but i'll try anyway.

As you create a project you can f.x. right-click the 'Source Files' dir in the solution explorer and select 'Add -> New Item'. Now in the coming window you can choose between a few different types of source file such as .cpp .h etc etc.

My question is:

What must I do, in this window, to be able to select a .c source file Currently the only method i've found is either to create a .c file outside the IDE and then add it to the project, or create a header-file and save it as *.c file.

There has to be a better way.



Visual Studio Express Editions7  
 
 
orcmid





PostPosted: Visual C++ Express Edition, Adding standard C "template". Top

[ ... ]

What must I do, in this [New Item] window, to be able to select a .c source file Currently the only method i've found is either to create a .c file outside the IDE and then add it to the project, or create a header-file and save it as *.c file.

There has to be a better way.

Use the C++ item template. But name the file with a .c extension. VC++ will honor your wishes.

Also, for plain Standard C, make sure that you are using the General VC++ Project type, with Empty project template.

If you want to avoid using Microsoft extensions, right-click your .c file and select Properties | Configuration Properties | C/C++ | Language and change "Disable Language Extensions" from "no" to "yes".

Although some will complain that Visual C++ is not ANSI/ISO C99 compliant (Microsoft chose a path that is closer to alignment with ISO C++ and having a C++-compatible C Language subset), it is great for making "Clean C" programs and you should find it enjoyable to use that way.

If you want to build code that is more integrated with the Windows Platform (e.g., Dynamic Link Libraries, WinApps, etc.) you'll need to enable extensions again. But you can decide how to do that, and best isolate the platform dependencies, later on.

- Dennis