Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > BOOK: Ivor Horton's Beginning Visual C++ 2010
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 24th, 2012, 11:30 AM
Registered User
Points: 16, Level: 1
Points: 16, Level: 1 Points: 16, Level: 1 Points: 16, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chap 1 - Creating a CLR Console Project

First, the operating background:
Im using a MacBook Pro win OS x 10.7 and Parallels 7 for Mac. Guest OS is Win 7 Pro (64 bit) SP1 with Visual Studio 2010 Ultimate installed (SP1). In Parallels settings, Mac shortcuts are disabled.

On page 26, I try to execute the console program, but just as it did with the other exercises, window pops on and immediately off the screen. In previous examples, I used System("pause"); to verify the output.

Ex1_03 fails if I use the System("pause") entry. It also doesn't work with the Console::Readline(); option.

Any idea what I might have missed? I don't want to continue ona flawed assumption.

I'm new at programming and VS so every bit helps and will consider all responses. Taking the class in the Fall; getting a head start.

Thanks in advance,

Rich
  #2 (permalink)  
Old June 25th, 2012, 12:19 AM
Authorized User
Points: 267, Level: 5
Points: 267, Level: 5 Points: 267, Level: 5 Points: 267, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2012
Posts: 66
Thanks: 0
Thanked 4 Times in 4 Posts
Default

nycursor,

first a disclosure:
I am a beginner also, but I have played with different ways to open a project and researched the Visual C++ compiler. I am using the Express (free) version of Visual Studio which does not have all the features and capabilities as your paid version. I am unsure whether or not that will give us the same results throughout the book, but at this early stage I am fairly confident that we should see no differences. ...end of disclosure...

I have a couple of ideas, but first I need some additional information from you to see if they apply.
__________________________________________________ ________

Are both your guest operating system and Visual Studio fully up to date? I have had many updates for Windows 7 SP1 and Visual C++ Express SP1. I do not know if any of these updates have addressed your issue. Since you are a Mac user, I have a warning here. The Windows updates may take multiple cycles to bring you fully up to date. Be prepared for multiple reboots followed by checking for updates again to complete the process. If you find and install any updates, try Ex3_01 again to see if it behaves like the book says. Please post back with your results or questions about the Windows update procedure. I'll be happy to help.
__________________________________________________ ________

Please post your code as it appears in the editor for me to examine. I would like to see if it differs from mine, which works properly. If you are not familiar with formatting forum posts, here is the method for posting code. It is really quite easy once it has been explained.
  • Your code must be inside code tags.
  • Copy your code from the editor in Visual Studio.
  • You must use an advanced reply. To do this click on the post reply button.
  • Find the # icon in the menu bar at the top, and click on it.
  • Paste the copied code between the code tags in the reply box in the forum.
  • It will look something like this when completed
    Code:
    several lines of code
  • Preview your post to see how it looks and make any necessary corrections before submitting your reply.
__________________________________________________ _

Please post back with questions, problems, or results. Your reply will help me determine the next step (if needed).

regards,
drpepper
  #3 (permalink)  
Old June 25th, 2012, 10:40 AM
Authorized User
Points: 267, Level: 5
Points: 267, Level: 5 Points: 267, Level: 5 Points: 267, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2012
Posts: 66
Thanks: 0
Thanked 4 Times in 4 Posts
Default

nycursor,

Please read my previous post also.

You said that Ex3_01 fails. Do you mean that the program runs, but the window fails to stay open? --or-- Do you mean that the output pane at the bottom of the window shows that the solution failed to build?

I missed this in your post.
Quote:
It also doesn't work with the Console::Readline(); option.
I missed the obvious in your reference. Notice the syntax difference between Console::Readline(); and Console::ReadLine();.

I modified my code to test this. If you type ReadLine using a lower case "l" instead of upper case "L", this causes the build to fail. The output pane includes this error message.
Quote:
error C3861: 'Readline' : identifier not found
Because you are new at both programming and VS, debugging (troubleshooting) errors may be a problem area for you. I have been there and am learning to more efficiently find errors. I can share an explanation of how to locate and decode build errors with you if you wish.

regards,
drpepper
  #4 (permalink)  
Old June 27th, 2012, 10:34 AM
Registered User
Points: 16, Level: 1
Points: 16, Level: 1 Points: 16, Level: 1 Points: 16, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Thanks, you nailed it

drpepper,

You were right, I didn't realize the command was case sensitive. Once I changed "Readline" to "ReadLine", it worked.

As for the System("pause"); statement, the build failed when I ran it. If I replace the "ReadLine();" statement with 'System("pause");'

I get the error: 'System' | illegal use of namespace identifier in expression

Build FAILED.

Thanks for the feedback.

cursor
  #5 (permalink)  
Old June 27th, 2012, 11:20 AM
Authorized User
Points: 267, Level: 5
Points: 267, Level: 5 Points: 267, Level: 5 Points: 267, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2012
Posts: 66
Thanks: 0
Thanked 4 Times in 4 Posts
Default

nycursor,

There are some things in C++ that are real finicky. The same thing that makes C++ powerful can also be difficult for beginners like you and me. At this early level of learning, the following are a few of the things you should know to help you write good code and find errors when debugging.
  1. Virtually everything is case sensitive. This includes variables you declare. int number; andint Number; declare different variables.
  2. Missing characters can run you in circles if you are not attentive to details. Omitting a semicolon, comma, period, opening or closing parenthesis or brace will give compiler errors or logic errors. Logic errors are potentially the worst. They will compile and run but yield incorrect solutions (sometimes). That is right, sometimes. Your code may give correct solutions for some data and incorrect solutions for other data.
  3. Each different variety of C++ programs has a different library of key words, commands, and general statement formats. Many of them are not interchangeable from one to another.

To reply to your use of pause, it is used in native C++. Ex1_03 is a CLR console project; therefore, it is not a valid statement. Pay close attention to the headings for each topic discussed in the book and the heading for each "Try it out" example. If you see CLR or C++/CLI, for example, use only statements, key words, etc. which are valid in that variety of C++. The use of pause is not recommended. See this article for an explanation. Google System("pause") for more articles if you are interested.

The error codes included in the help file can be very helpful. They are hard to find. I can guide you to them if you wish. If you have problems with the general methods for debugging, I can probably help. If you wish to go deeper into error codes or debugging guidelines, please start a new thread with an appropriate title. This will help others learn also.

Keep firing off your questions. I will be happy to help where I can. It helps me strengthen my understanding to reply to questions.

regards,
drpepper
  #6 (permalink)  
Old June 27th, 2012, 07:01 PM
Registered User
Points: 16, Level: 1
Points: 16, Level: 1 Points: 16, Level: 1 Points: 16, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Creating a Console Project

drpepper

Thanks for the patience and the feedback. The computer environment:
Both the host and guest are up to date with patched. Same for the Visual Studio.

I saw your explanation on the System("pause") statement not being vaild. I imagine that within the next few chapters, I'll learn more about which commands are limited to native/CLR environments. Looking forward to that discovery. I used the statement to see if there was another way to pause the line. Live and learn.

I'll take a look at the links for starters, thanks.

I'll welcome any tips on decyphering the build error codes.
Thanks again. I'll keep reading and I'll keep coding.
  #7 (permalink)  
Old June 27th, 2012, 07:25 PM
Authorized User
Points: 267, Level: 5
Points: 267, Level: 5 Points: 267, Level: 5 Points: 267, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2012
Posts: 66
Thanks: 0
Thanked 4 Times in 4 Posts
Default

nycursor,

it is good to know that you have everything updated. Proper updating not only addresses bugs and introduces new features. In many cases it also addresses security vulnerabilities.

The which works with what issue will come naturally after some repetition. I like to keep hand written notes handy to refer to when deciding how to open a project, decide which commands to use in the various environments, what to include for a given task, what to avoid, etc. It saves me look up time and troubleshooting time.

The teacher in me is tickled that you are trying to get up to speed before classes begin. (No, I am not a teacher. I just have one hiding inside of me. I started tutoring over forty years ago when I was in junior high school and have never quit.) From experience in a college classroom I can predict that you will be ahead of most of the class, and maybe even your teacher, if you have a working knowledge of the error code look ups. I just completed an intro to programming course in May. The last four or five weeks were an intro to the C language, using Visual C++ 2010 Express. The professor had no idea where to find the error codes.

When you get caught up and are ready for the error codes, start a new thread devoted to that topic. Using separate threads for each topic makes it easier for someone like you or me to find information we need. Give it a title something like "where can I find error code explanations?" I have notification of new topics enabled and will receive a notification when you start a new thread.

ready when you are...
drpepper
  #8 (permalink)  
Old June 30th, 2012, 11:16 AM
Authorized User
Points: 267, Level: 5
Points: 267, Level: 5 Points: 267, Level: 5 Points: 267, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2012
Posts: 66
Thanks: 0
Thanked 4 Times in 4 Posts
Default

nycursor,

While awaiting you reply, I composed a post giving instructions for finding descriptions of compiler errors. you can find it here.

Please reply back, and let me know what you think. Your feedback may help me edit the information if necessary.

regards,
drpepper
  #9 (permalink)  
Old July 1st, 2012, 11:21 AM
Registered User
Points: 16, Level: 1
Points: 16, Level: 1 Points: 16, Level: 1 Points: 16, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

drpepper,

Thanks. The link should help a lot. I'm going to print it out and use it with the next set of errors I get. I'll use it as a sort of template.

Sorry it's taking me a while to get back. Weekends are really the only chance I get to start studying. That's actually exactly why I'm starting from now.

I also just got the tect for the class (which starts in the fall). I'll bounce between the two to get different explanation of the same subject. I'm hoping that will provide clarification.

As I get deeper into the book, I'll be sure to cross reference things with what I've found here. Hopefully, before long I'll know enough to provide some not too dangerous answers to someone else's questions.

On to chapter 2. It's slower than I hoped, but so far, I'm digesting it.

Thanks again.
  #10 (permalink)  
Old July 1st, 2012, 12:56 PM
Authorized User
Points: 267, Level: 5
Points: 267, Level: 5 Points: 267, Level: 5 Points: 267, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2012
Posts: 66
Thanks: 0
Thanked 4 Times in 4 Posts
Default

nycursor,

FIRST: I commend you for taking the time to digest the concepts. Most of the forums I am familiar with are populated with people who just want answers and don't care about understanding. Keep the good attitude, and you will have a better foundation for success. Be prepared for your upcoming class having a faster pace.

One thing I failed to mention in the linked post about compiler errors is that if you download the help files, you can bookmark them (add to favorites within the help files). I don't know if you can do this with the online help or not. (Try it and see; or if you wish, I can provide instructions for downloading the help files to your computer. To conserve system resources at the expense of using more memory and/or disk space you may want to try this on your virtual machine.) I saved this trick for you because you have had the patience and follow through to continue the dialog with me.

After you have expanded the left pane far enough to see the build errors, look at the bottom of the left pane. You should see tabs which say: Contents, Index, Favorites, and Results. Let's say, for example, you have compiler errors in the C2600-C2699 range on a regular basis. Expand the Build Errors, and right click on C2600-C2699. Choose add to favorites. In the future any time the Help files are open you can click the Favorites tab and then click C2600-C2699 to go straight to that listing to choose the error you want to view.

Don't lean on compiler errors as the first step in debugging. Look for syntax errors first. See my basic debugging of programs thread for beginner's level instruction's on debugging. You really need to do what is in that link before looking for compiler errors.

To get the most out of the instructions, copy the code I provide and build it. Then follow the instructions provided. At the point where I turn the user out on his own, find the remaining errors until you have a program that compiles without errors and runs as intended. Give me some feedback.

One final thing: I see and appreciate your thanks and return a warm, "you're welcome". Please do not take this as begging for recognition. Many forums provide a method to thank (or otherwise recognize helpfulness, courtesy, ...). Out of courtesy give recognition when you are in the forums which offer this option. In many forums the contributors are more willing to help those who have the courtesy to offer the special recognition provided by the forum. You may find this helpful as you get to more advanced questions or find yourself dealing with a professional when posing elementary questions.

Feel free to fire away with more questions or new topics.

regards,
drpepper
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
(Chap. 7) Creating Thumbnails/Photo Galleries SmoothAl BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 3 March 2nd, 2010 06:27 AM
Adding existing Console/project ? chiefarchon BOOK: Beginning Microsoft Visual C# 2008 ISBN: 978-0-470-19135-4 0 September 19th, 2008 07:51 AM
problem using "string"(CLR project) rsm1235 C++ Programming 0 February 4th, 2006 11:07 AM
Please!!Chap 07-Creating an Installer amouzeshgah VB.NET 2002/2003 Basics 0 September 13th, 2005 11:28 PM
Chap 12 Project tracker - listboxes don't clear trancelife BOOK: Beginning Access 2003 VBA 1 February 14th, 2005 12:15 PM



All times are GMT -4. The time now is 08:08 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.