How to debug C++ code in Visual Studio 2005

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • stand
    New Member
    • Mar 2008
    • 2

    How to debug C++ code in Visual Studio 2005

    Hi,
    It should be noticed, I'm not a proff. programmer. I wrote in C++, Pascal, mapple, matlab time by time.
    I want to test and debug one math algorithm, so I created new project for it.
    Then in the Source file folder I created new cpp file, wrote the code, built the solution. There are no mistakes in code, but when I put some breakpoints to look into variables' values and started debugging, the error have appeared: "No debugging information.Deb ugging information for 'devenv.eve' connot be found or does not match."
    I searched in different forums, but couldn't find any helpful information.
    I read the VS help, checked configuration manager (configuration: debug, platform:win32, build:yes), tried again - no result.
    1) What should I do to be able to debug simple C++ project?
    2) is there any possibility to compile and debug just one file without creating any projects?
    3) when and where can I see the results of program's work?
    I put some "cout" in the program, but the output window is empty after building the project.

    I wil be VERY grateful for any structured advices and references to related forums, articles etc.
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    You need to be certain that you are doing a debug build and that all of your libraries are debug libraries.

    A debug build places code in the .exe to support the debugger. There are also worker files in the /debug folder of your project to support this also.

    If you have a release build, this code is absent and you get the message you describe.

    Note: a debug build does not mean defining the prepeocessor _DEBUG symbol.

    Comment

    • stand
      New Member
      • Mar 2008
      • 2

      #3
      Originally posted by weaknessforcats
      You need to be certain that you are doing a debug build and that all of your libraries are debug libraries.

      A debug build places code in the .exe to support the debugger. There are also worker files in the /debug folder of your project to support this also.

      If you have a release build, this code is absent and you get the message you describe.

      Note: a debug build does not mean defining the prepeocessor _DEBUG symbol.
      Thank you for responce. That problem disappeared by itself.
      But I have new one. The same issue - I can't debug the code. Here is the description:

      I created an empty project "ConsoleApp 6". Added a ConsoleApp6.cpp .
      Typed the following code:

      #include <stdio.h>

      int main() {
      printf ("Hello!\n") ;
      return 0;
      }

      Solution is built successfully.
      Folders
      ./ConsolApp6/ConsolApp6/
      ./ConsolApp6/ConsolApp6/Debug
      are created and contain BuildLog.html and etc.
      Running ConsoleApp6.exe works as well.
      However when I start debugging I see the error message:
      "Debugging information for "ConsoleApp6.ex e" cannot be found or does not match. Binary was not built with debug information.
      do you want to continue debugging?"
      After choosing Yes I see in the output:
      "'ConsoleApp6.e xe': Loaded 'E:\Visual Studio 2005\Projects\C onsoleApp6\debu g\ConsoleApp6.e xe', Binary was not built with debug information.
      'ConsoleApp6.ex e': Loaded 'D:\WINDOWS\sys tem32\ntdll.dll ', No symbols loaded.
      'ConsoleApp6.ex e': Loaded 'D:\WINDOWS\sys tem32\kernel32. dll', No symbols loaded.
      'ConsoleApp6.ex e': Loaded 'D:\Program Files\Common Files\LogiShrd\ LVMVFM\LVPrcInj .dll', No symbols loaded.
      'ConsoleApp6.ex e': Loaded 'D:\WINDOWS\sys tem32\user32.dl l', No symbols loaded.
      'ConsoleApp6.ex e': Loaded 'D:\WINDOWS\sys tem32\gdi32.dll ', No symbols loaded.
      The thread 'Win32 Thread' (0x4d4) has exited with code 8388608 (0x800000).
      The program '[852] ConsoleApp6.exe : Native' has exited with code 0 (0x0).
      "
      I tried to create WinConsoleApp using template, tried to restart Visual Studio, restart my computer, nothing helps.
      What is the problem?

      Comment

      Working...