Wrox Programmer Forums
|
BOOK: Ivor Horton's Beginning Visual C++ 2010
This is the forum to discuss the Wrox book Ivor Horton's Beginning Visual C++ 2010 by Ivor Horton; ISBN: 9780470500880
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Ivor Horton's Beginning Visual C++ 2010 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 August 5th, 2012, 01:49 PM
Registered User
 
Join Date: Aug 2012
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Default Ex3_01 Does not compile

I have had no problems up to this point. But this example, downloaded from Wrox will not compile.
I get:
.
>Ex3_01cpp(42): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?
But have no idea what to do next.
I am running Visual Studio Professional version 10.0.30319 under Windows 7.
Any help?

Last edited by JamesBrown; August 5th, 2012 at 01:52 PM.. Reason: typo
 
Old August 5th, 2012, 03:11 PM
Authorized User
 
Join Date: May 2012
Posts: 66
Thanks: 0
Thanked 4 Times in 4 Posts
Default

JamesBrown,

The problem lies in the method you used to open a new project. At this stage of the book, there are two types of programs Win32 Console programs and CLR C++/CLI programs. The preprocessor directive #include "StdAfx.h" is used in CLR C++/CLI programs. The Win32 console programs do not use this preprocessor directive.The code as presented in the book is for a Win32 Console Project.

When going through the book, there are a few ways to tell which type of project to open:
  • Up to this point in the book, all example programs at the beginning of the chapter are Win32 Console programs. When you come to a bold topic heading which says "C++/CLI PROGRAMMING", you are entering that type of examples.
  • Look in the highlighted bar nest to the TRY IT OUT bar or the text under the highlighted bat to see if it mentions a CLR program. If so, that example and the ones following are going to be C++/CLI programs.
  • As time progresses you will recognize the difference by repetition.

When I began the book, I printed out all the code for the different types of projects and made notes on them for reference. You may find it helpful to do the same.

To make your code compile and run go back to Chapter 1 and read the procedure for Creating a Project for a Win32 Console Application in the TRY IT OUT FOUND under the Defining a Project topic heading. This is on page 14 of my book. It may be on a different page if you have a different printing of the book. Then type the code and build it again. Let me know how that works for you.

drpepper
The Following User Says Thank You to drpepper For This Useful Post:
JamesBrown (August 5th, 2012)
 
Old August 5th, 2012, 07:43 PM
Registered User
 
Join Date: Aug 2012
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Default Thanks

much appreaciated...
 
Old August 6th, 2012, 12:18 AM
Authorized User
 
Join Date: May 2012
Posts: 66
Thanks: 0
Thanked 4 Times in 4 Posts
Default

You're welcome. Thanks for clicking the thanks button for me.

drpepper
 
Old August 6th, 2012, 09:41 AM
Authorized User
 
Join Date: May 2012
Posts: 66
Thanks: 0
Thanked 4 Times in 4 Posts
Default

JamesBrown,

I neglected to mention one other thing. In your first post you mentioned downloaded code. The downloaded code is fine for checking your code against the code provided. You may find that there is a better way to write the code than what you choose as a student.

The best bet is to write your own code and attempt to build and run the program. You will get experience needed to write code for exercises or programs of your own. There is no substitute for writing it yourself while learning. Think of it as being similar to the difference between reading an book and writing a book. Practice in writing style builds strength in the necessary skills.

respectfully,
drpepper





Similar Threads
Thread Thread Starter Forum Replies Last Post
compile aspb ASP.NET 2.0 Professional 1 September 12th, 2006 10:22 AM
compile aspb ASP.NET 2.0 Basics 0 September 8th, 2006 10:27 AM
Compile Louisa VB.NET 2002/2003 Basics 1 November 23rd, 2005 10:14 AM
C# compile biran Visual Studio 2005 1 July 15th, 2005 01:36 PM
How Compile the First Example ? AlexPerusso BOOK: Beginning Visual C++ 6 3 April 8th, 2005 10:44 AM





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