Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

New to Visual C++

  1. Apr 30, 2010 #1
    I need to learn how to use the Visual C++ 2010 express IDE.
    My programming skills are good enough to write code but when i open a project in the 2010 IDE I am overwhelmed by what is presented as the starting code. I have never used this environment before. Is there a good book on the IDE that will help me understand what I am looking at?
  2. jcsd
  3. Apr 30, 2010 #2


    User Avatar

    Staff: Mentor

    What do you mean "starting code"? Do you mean code generated when you create a project? If so, it is not a problem with IDE, but with the task and project template. To understand the code you need to know something about API you are going to use.
  4. Apr 30, 2010 #3


    User Avatar
    Homework Helper

    Start a new project, then be sure to click on next, then "empty project", before clicking on finish.
  5. Apr 30, 2010 #4
    Visual Studio will automatically generate code for a new project only if you explicitly tell it to. You can do this by, for example, instructing it to use precompiled headers or to add headers to your project for ATL or MFC classes. If you don't know what any of this means, pick yourself up a good book on Visual Studio and start studying.

    You can prevent anything being added to a new C++ project by telling VS to produce an empty project in the new project wizard.
  6. May 1, 2010 #5
    It all depends what your looking to do. If you just want to practice writing C++, your best best is to create a console application. That will just give you a main method which you can start implementing.
  7. May 1, 2010 #6
    What I want to do is to write a stand-alone windows application (completely new to me) using drop down menus and or pop-up windows to select items that will be built into a structure that I can use to perform all my calculations on. It will then be put into a scrolling page for display. I also want to print the information in a convenient format to store as hard copy. The console application (as I understand it) is what I wrote 25 years ago and can't be printed because Windows controls the printer now and the software (old) can't access it.
    Can I accomplish this use of drop-down menus and pop-up windows in a stand-alone application without using the WinApp template?

    Can you recommend any books on the visual C++ 2010 express IDE? Is it the same as all previous versions? I have got Steve Holzner's "Microsoft Visual C++" 14 essential skills book but it is an old book (1997) and I doubt it has the latest libraries or formats. Thanks for helping this old man find his way in this ever-changing world of programming.
    Last edited: May 1, 2010
  8. May 1, 2010 #7
    Previous editions of Ivor Horton's books on Visual C++ have generally been well received. I haven't had a chance to read the new edition, which focuses on VC++ 2010, but I would assume it is of the same high standard. He goes into quite some detail about the mechanics of using Visual Studio and VC++, and there's quite a bit about developing graphical Windows applications using Microsoft Foundation Classes and Windows Forms. In short, I'd be surprised if there's anything you need which isn't covered in Horton.

  9. May 1, 2010 #8
    There are a few options for doing GUIs in Visual C++ Express :-

    Use the raw windows API - The purest but most time inefficiant method see http://www.winprog.org/

    Use a third party library like WxWidgets. See http://www.wxwidgets.org/ This is probably your best bet if using C++.

    But it would make life a lot easier if you were to use C#.

    Console applications have just the same access to resource as any other program. The only different is you get a console for easy IO.

  10. May 1, 2010 #9
    I have ordered the book - thanks for the heads up. - really, thank you.

    What makes C# better? and what are the limitations of it?
    Is it a subset of C++ or does it have all the capabilities - structures, file I/O, Objects and classes?
    Thank you,
  11. May 2, 2010 #10
    C# is a language based roughly on C++ syntax but has been designed from the ground up by Microsoft. It has all the capabilities of C++ plus lots more.

    Some of the advantages are

    • It's memory managed - no more deleting memory or memory leaks
    • Cleaner syntax - No more pointers, unicode macros, cryptic functions etc
    • Comes with a very comprehensive library allowing you to do pretty much anything.
    • Bounds checking - helps with buffer overflows
    • Supports lambda expressions, partial classes and type safe database query's inside the code (LINQ)

    The only disadvantages I can think of is it initializes slightly slower and you need to ensure users have the .NET runtime installed.

    Its also worth noting that Java does most of the above aswell.

    You can find more information here: http://msdn.microsoft.com/en-gb/beginner/bb308730.aspx

    Hope that helps
  12. May 2, 2010 #11


    User Avatar

    Staff: Mentor

    And you are limited to Windows. Depending on your target audience this doesn't have to be disadvantage.
  13. May 2, 2010 #12
    Umm well yes and no. C# is an open specification so anyone is welcome to write an implementation of it but Microsoft only support Windows. There is a project to create a .NET runtime for Mac and Linux called Mono (http://www.mono-project.com/Main_Page) but the last time I tried it which, was about three years ago, there was quite a bit missing.

    I think for cross platform development, Java may be a better bet but for Windows, my preference is C#.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook