Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to use VC++ 2010 without including stdafx.h?

I've successfully installed M$ VC2010 and start writing simple programs using it.

I am very annoyed from the #include<stdafx.h>, So is there any way to compile and run programs without it???

like image 870
Muhammad Hewedy Avatar asked May 26 '10 03:05

Muhammad Hewedy


People also ask

Does Stdafx H need?

stdafx. h is basically used in Microsoft Visual Studio to let the compiler know that the files are once compiled and no need to compile it from scratch.

What is the purpose of Stdafx H?

Precompiled Header stdafx. h is basically used in Microsoft Visual Studio to let the compiler know the files that are once compiled and no need to compile it from scratch. The compiler would always compile this header files from scratch.

What is Stdafx CPP?

Stdafx. cpp is that one . cpp file. It has a setting that's different from all the other . cpp files, it gets built with /Yc.


5 Answers

It's for pre-compiled headers. Don't use pre-compiled headers, don't include it.

like image 139
KTC Avatar answered Nov 15 '22 05:11

KTC


Goto Project Settings->Precompiled Headers. Select Not using precompiled headers.

like image 43
aJ. Avatar answered Nov 15 '22 07:11

aJ.


You can also turn off precompiled headers per file.

Setting this in VS Express C++ 2012 is as follows:

  1. In Project Explorer right-click on .cpp file, select Properties.
  2. On the left pane select Configuration Properties/C++/ Precompiled Headers
  3. Now, on the right pane there is 'Precompiled Header' value which you can change from Use /Yu to :
    • 'Not Using Precompiled Headers'

Cheers enter image description here

like image 43
Nick Avatar answered Nov 15 '22 05:11

Nick


Of course, just go to Project Settings, C/C++ → Precompiled Headers, and choose "Not Using Precompiled Headers".

BTW: On large projects using precompiled headers may significantly decrease build time.

like image 41
ivanzoid Avatar answered Nov 15 '22 06:11

ivanzoid


When you create your project, create an empty project.

For now, you can disable it in Project Settings.

like image 37
Warty Avatar answered Nov 15 '22 07:11

Warty