The new forums will be named Coin Return (based on the most recent vote)! You can check on the status and timeline of the transition to the new forums here.
The Guiding Principles and New Rules document is now in effect.

Getting Used to Visual Studio

Mai-KeroMai-Kero Registered User regular
I'm in my second semester of CS, and currently taking my second class involving C++. To be honest, I have not learned a lot. So far I've been using notepad++ and a command line compiler, but my professor is insistent on everyone using Visual Studio now. My problem is, the program seems overly complicated for what we're doing so far and I'm kind of wondering what the point is. So far the only benefit to it I've seen is compiling in the same window.

Is anyone aware of a nice tutorial for using this program? Something that maybe walks me through writing something in it with multiple classes/things and using Visual Studio to it's full potential?

Mai-Kero on

Posts

  • DehumanizedDehumanized Registered User regular
    edited March 2011
    All kinds of tutorials here:

    http://msdn.microsoft.com/en-us/vstudio/

    Dehumanized on
  • ZxerolZxerol for the smaller pieces, my shovel wouldn't do so i took off my boot and used my shoeRegistered User regular
    edited March 2011
    It has a pretty bitching debugger and auto-completion.


    edit: a lot of it has to doe with the IDE and tool suite, basically. Letting the program manage your sources, setting up build targets, pressing F5 and watching it go, pause, walking through call stack, and then resume, that sort of thing. One cpp file, and it doesn't matter much maybe. A couple hundred of sources and libraries and shit, on the other hand...

    You know, it's what hardcore *nix/GCC dudes call nub mode. Makefile? wazzat

    Zxerol on
  • ecco the dolphinecco the dolphin Registered User regular
    edited March 2011
    Zxerol wrote: »
    It has a pretty bitching debugger and auto-completion.

    The debugger is pretty awesome!


    OP: Just for experimentation, set the configuration of a simple C++ project to "Debug", and set a breakpoint at any point in the code.

    To set a breakpoint, click on any executable line in your source code, and go "Debug -> Toggle Breakpoint".

    Run your app, and the VS debugger should break on that line of code.

    Once you're in debug mode, here are a few things to try:


    Local Variables: Debug -> Windows -> Locals

    This should show the values of the local variables.

    You should see at least three columns, "Name", "Value", and "Type".

    As you step through the code (Debug -> Step Into/Over), you should see the local variables change. The ones that are highlighted in red are the ones that have changed values as a result of stepping.

    You can also edit the values of variables in here, if you know what you're doing. Just double click on the "Value", enter a new value, and your programme will continue running with the variable being assigned that new value! Quite useful to shoot yourself in the foot with.


    Call Stack: Debug -> Windows -> Call Stack

    This shows the call stack - i.e. which functions were called in order to get to your current position in the code.

    This is pretty useful if you know you crash in a certain function, but the function gets called from all over the place.

    As an experiment, double click anywhere on the call stack - and watch the local variables change.



    There are plenty more things that VS can do, (e.g. conditional breakpoints, memory viewer, watch, to name a few of the more common ones), but those two should see you through a lot of beginner level debugging.

    ecco the dolphin on
    Penny Arcade Developers at PADev.net.
Sign In or Register to comment.