Wrox Programmer Forums
|
BOOK: Professional C++, 2nd Edition
This is the forum to discuss the Wrox book Professional C++, 2nd Edition by Marc Gregoire, Nicholas A. Solter, Scott J. Kleper ; ISBN: 978-1-1181-6995-7
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional C++, 2nd Edition section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 12th, 2016, 10:29 PM
Authorized User
 
Join Date: Nov 2014
Posts: 91
Thanks: 2
Thanked 1 Time in 1 Post
Default Chapter 6, page 137, #include "stdafx.h"

The tip block says that if you are using the Microsoft C++ IDE, you will notice that all cpp files start with #include "stdafx.h".

I am using Visual Studio 2013 Professional Edition. When I create a cpp file, I uncheck the precompile header box and check the empty project box. The cpp file does not come with the #include "stdafx.h". How do I make the selection so that the cpp file comes only with the #include "stdafx.h"?

Also, what does "stdafx.h" do and why is it needed?
 
Old April 17th, 2016, 01:36 PM
Wrox Author
 
Join Date: Mar 2011
Posts: 49
Thanks: 0
Thanked 4 Times in 4 Posts
Default

The stdafx.h header is only used when you check the precompiled header checkbox.
In this header you can put your most used headers that you use, for example, you can put the C++ Standard Library headers you are using in your stdafx.h. You can also put your own headers in it that you often use across multiple cpp files.
This stdafx.h will be precompiled by the compiler and this speeds up the compilation process. Note that you should only put headers in stdafx.h that are stable, i.e. that don't change often. More information specific to Visual C++ can be found here: https://msdn.microsoft.com/en-us/library/szfdksca.aspx
 
Old April 17th, 2016, 06:13 PM
Authorized User
 
Join Date: Nov 2014
Posts: 91
Thanks: 2
Thanked 1 Time in 1 Post
Default Chapter 6, page 137, #include "stdafx.h"

Thank you for your response, Marc.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 5, p 137 "Class Name combo box" Kodiak Services Beginning Visual Basic 2012 2 June 27th, 2013 09:57 AM
Base Page Problem with "safeitenames" carryover in the 'inherits" johnandrewmcknight BOOK: Beginning ASP.NET 4 : in C# and VB 3 April 22nd, 2011 04:08 PM
Problem: Chapter 7 "Saving Your To-Do List" (Page 218) DrGaribaldi BOOK: Professional Android 2 Application Development 2 March 21st, 2011 01:53 AM
Problem: Chapter 8 "Mapping Earthquakes Example" (Page 282) DrGaribaldi BOOK: Professional Android 2 Application Development 3 July 29th, 2010 06:24 PM
Problem: Chapter 7 "Creating and Using an Earthquake Content Provider" (Page 232) DrGaribaldi BOOK: Professional Android 2 Application Development 0 June 17th, 2010 04:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.