How to set up a Standard C project

This document seems to be correct for Visual Studio 2012; the choices are similar in the 2010 version.

Visual Studio assumes you are doing a C++ project that works in the Windows GUI environment. So, first, create a "Win32 Console application" and specify an empty project.

Then create and add at least one source file to the project.

Then apply the following changes to change it from C++ to C:


1. In the 'Solution Explorer', right-click on the project and select 'Properties', then 'Configuration Properties' then 'C/C++' then do the following under 'All Options'


a. Set 'Compile As' to 'Compile as C Code'


b. Set 'Enable C++ Exceptions' to 'No'


c. Set 'Floating Point Model' to 'Strict'


2. Then under 'C/C++' then 'Language', do the following:


a. Set 'Disable Language Extensions' to 'Yes'


b. Set 'Treat wchat_t as Built-in Type' to 'No'


3. Then under 'C/C++' Preprocessor, Append '_CRT_SECURE_NO_WARNINGS' to the list of 'Preprocessor Definitions'. This will get the compiler not to flag use of the traditional string handling functions as being errors, and so will allow use of the 1989 C Standard Library.


This will get you relatively close to the C89 standard, but it may still allow some things that the gcc with our recommended settings would not. We recommend testing with a build and check with the course "Standard" gcc settings before submitting.


See the "submit example" under Other Information on the Project 1 web page.


How to set up a Standard C++ project

Hint: Consider creating a "generic project" named something like "EECS381Project" and get the settings to work correctly. You can then "recycle" this project by removing old files from both the directory and the project, and adding the new files to both the directory and the project. Do a "Clean" before the first build of the new project. This will save set-up time for a new project.


First, create a "Win32 Console application" and specify an empty project.

Then create and add at least one source file to the project.

Then apply the following changes to change make it slightly more standard:


1. In the 'Solution Explorer', right-click on the project and select 'Properties', then 'Configuration Properties' then 'C/C++' then do the following under 'All Options'


a. Set 'Compile As' to 'Compile as C++ Code'


b. Set 'Enable C++ Exceptions' to 'Yes'


c. Set 'Floating Point Model' to 'Strict'


2. Then under 'C/C++' then 'Language', do the following:


a. Set 'Force Conformance In For Loop Scope' to 'Yes'


3. Then under 'C/C++' Preprocessor, Append '_CRT_SECURE_NO_WARNINGS' to the list of 'Preprocessor Definitions'. This will get the compiler not to flag use of the traditional string handling functions as being errors, and so will allow use of the functions in the Standard C++ Library <cstring> (needed in Project 2).


This will prevent some non-standard compiler behavior, but it may still allow

some things that the gcc with our recommended settings would not.

We recommend testing with a build and check with the course "standard" g++ settings before submitting.


Note: An earlier version of this document had the following under step 2 above. Using these settings causes compiler errors on some of the Standard Library code like <iostream>, which has to be some kind of a bug in the implementation. Leave these at their defaults (for a new project), or set them to the opposite of what is listed below:

a. Set 'Disable Language Extensions' to 'Yes'

b. Set 'Treat wchat_t as Built-in Type' to 'No'