cannot debug "Hello world!"

Hi, I created a win32 console application starting with an empty project using Visual Studio 2005. I then added a cpp file and typed in the following code:

#include <iostream>
using namespace std;

int main()
{
     cout << "Hello world!\n";
     return 0;
}

When I try to run the program by pressing "Start Debugging" (F5), a console window appears then I get a popup saying : "There is no source code available for the current location." I then have an option to "Show Disassembly". I can see my output in the console window if I click "Start Without Debugging" (Ctrl+F5).

I searched the forum but don't seem to find anybody who has encountered the same problem. Does anybody have any idea what may be causing this

Thanks in advance.



Answer this question

cannot debug "Hello world!"

  • Jo&amp;#227;o Marcelino

    Actually I have created many many new projects (test1, test2, test3...) with just one hello world cpp file each. There shouldn't be any old pdb files in this case right I'm starting to feel there is something wrong with my computer.. >.<
  • &amp;#34411;&amp;#35960;

    you might try the command line compiler and linker. if those work its probably your vc++ install.
  • PrakashV

    I am choosing "Debug" in the combobox when I get the popup: "There is no source code available for the current location." with the option to choose "Ok" or "Show Disassembly"

    I tried choosing "Release" in the combobox and got the popup: "No symbols are loaded for any call stack frame. The source code cannot be displayed." with the same option to choose either "Ok" or "Show Disassembly"

    Also, I noticed that when I choose "Debug" in the combobox and try to debug, there is a yellow arrow pointing to "windows_Hook.DLL!004407ae()" in the call stack window after I choose "Ok"


  • Ed Teach

    It is really supposed to work ...
    Could there be something wrong with my installation
    Hmm..


  • Niaz

    I also thought it might be some setting.. But I haven't changed any settings at all since install.. I even tried importing default VC++ settings and general settings from "Tools > Import and Export Settings" but it doesn't work too... I wonder what setting can still be wrong here..
  • dennist

    Sorry. Than I have no more idea. This code works perfect on my machine when I try to debug it.

  • Robert McIntyre - MSFT

    Hi there,

    these people have a point may be you should check your environment settings first before moving on to something else may you missed a small setting somewhere

    Regards,

    Smith


  • ikeeickholdt

    I didn't place any breakpoints.

    The only code I have is :

    #include <iostream>
    using namespace std;

    int main()
    {
         cout << "Hello world!\n";
         return 0;
    }

    By the way thanx a lot for trying to help ! :)


  • BLueDeViL

    I'll just have to wait on then~

    Thanx a lot for your help :)


  • ss23

    It was something wrong with my computer.. Going to format my disk now..

    Thanx a lot to Martin, Ayman and Smith for trying to help esp Martin ! Thanx a lot !


  • Sharkboy

    There are to modes to create a EXE file. Debug and Release. There is a combobox in the toolbars that shows the current mode you are compiling and testing. Select debug and try it again.

    The default settings for release build don't include debug symbols.



  • Rupesh Rao MSFT

    Try cleaning the project. I am sure that is a scenario that works. Also delete any old pdb files.

    Thanks,
    Ayman Shoukry
    VC++ Team


  • HariValath

    Did you placed any breakpoints Try to remove them all, open the debug window and remove all breakpoints. Maybe there is a breakpint set where there is indeed no sourcecode available.

  • cannot debug "Hello world!"