MVS 2008 Settings C or C++ Compiler

 

- Info:

- This tutorial shows how to tell MSV 2008 which compiler to use, C or C++ compiler.

- This is important because MSV 2008 will not automaticly apply appropriate compiler depending on the file extension.

 

- Define Compiler for Project:

- RC on Project Properties... Configuration Properties C/C++ Advanced

 

- Compile As:

- Compile as C++ Code (/TP)

- Compile as C Code (/TC)

 

- Define Compiler for File:

- RC on File Properties Configuration Properties C/C++ Advanced

 

- Compile As:

- Compile as C++ Code (/TP)

- Compile as C Code (/TC)

 

- Test:

- You can use following code to test which compiler is active.

- C compiler should report error because in C, unlike C++, all variables MUST be declared at the begining of the function.

- Create C++ Console Application Test.cpp.

Test.cpp

#include <stdio.h>

int main () {

printf("%s","Hello");

int i = 1;

printf("%i",i);

return 0;

}