Using Visual C++ 2010

We’ve finally come to the end of the trail! In the previous post, Using CodeBlocks 10.05 – Part 8, I was able to cover up to the end of Book VI of C++ All-In-One Desk Reference For Dummies. This post begins with Book VII Chapter 1. After you’ve read this post, you’ll have the complete story on code updates for my book unless someone comes up with additions I need to make, which will appear in future posts. You can find a complete list of these posts in the C++ All-in-One for Dummies category archive.

Book VII doesn’t rely on CodeBlocks 10.05. Instead, the original text relies on Visual C++ 2008. In the interest of completeness, I decided to test the code in this book with Visual C++ 2010just to make sure it works. I used the version of Visual C++ 2010 that comes with the full product and didn’t test using an Express edition.


If you have problems with an Express edition product, please let me know and I’ll do my best to accommodate your needs. However, you should know in advance the the Express editions are, by design, incomplete and the examples may not work no matter how hard you work. The idea is that you’ll buy the full version of the product to get the functionality you need.

Always open the Solution (.SLN) file associated with the project to get the best upgrade. Whenever you open one of the book’s projects using Visual C++ 2010, you’ll see the Visual Studio Conversion Wizard dialog box shown here:


Simply click Finish and the wizard will convert the project to work with Visual C++ 2010. After the conversion is complete, you’ll see a completion dialog box. Clear the Show the Conversion Log When the Wizard is Closed option and then click Close. You’ll see the converted project.

The converted project won’t display any source code files. So, you’ll need to open Solution Explorer. In Solution Explorer, open the Source Files folder and double click the .CPP file associated with the project, such as Hello World.cpp for the project in Book VII Chapter 1. At this point, you can set breakpoints and then click Start Debugging to see the example run, just as you ordinarily would.


Before you can use the debugger with any of the examples, you must recompile them using Visual C++ 2010. Otherwise, the debugger will report errors and not run. Choose Build | Rebuild Solution to rebuild you application.

Some of the examples may display a warning message such as this one when you rebuild them as part of the upgrade:


LINK : warning LNK4075: ignoring ‘/INCREMENTAL’ due to ‘/PROFILE’ specification
SimpleDialog.obj : warning LNK4075: ignoring ‘/EDITANDCONTINUE’ due to ‘/OPT:REF’ specification

This message doesn’t appear to cause any problem with the example working as described in the book. Please let me know if you experience any problems in this regard.

The SimpleDialog example found in both Chapters 2 and 5 requires a change to the CSimpleDialogDlg::OnBnClickedCheck() method to make the buffer work as expected. Use the following code instead:

void CSimpleDialogDlg::OnBnClickedCheck()
    // Obtain the input string from m_Input.
    CString ThisString = _T("");
    int len = m_Input.LineLength(0);
    m_Input.GetLine(0, ThisString.GetBuffer(len), len);
    // Release the buffer created for ThisString.
    // Place the information in m_Output.

This should be the only problem you encounter while working with the code. Please let me know if you have any questions about any of the examples in the book at

Author: John

John Mueller is a freelance author and technical editor. He has writing in his blood, having produced 99 books and over 600 articles to date. The topics range from networking to artificial intelligence and from database management to heads-down programming. Some of his current books include a Web security book, discussions of how to manage big data using data science, a Windows command -line reference, and a book that shows how to build your own custom PC. His technical editing skills have helped over more than 67 authors refine the content of their manuscripts. John has provided technical editing services to both Data Based Advisor and Coast Compute magazines. He has also contributed articles to magazines such as Software Quality Connection, DevSource, InformIT, SQL Server Professional, Visual C++ Developer, Hard Core Visual Basic, asp.netPRO, Software Test and Performance, and Visual Basic Developer. Be sure to read John’s blog at When John isn’t working at the computer, you can find him outside in the garden, cutting wood, or generally enjoying nature. John also likes making wine and knitting. When not occupied with anything else, he makes glycerin soap and candles, which comes in handy for gift baskets. You can reach John on the Internet at John is also setting up a website at Feel free to take a look and make suggestions on how he can improve it.