Panda3D Manual: Running Panda3D under the CXX Debugger

These instructions show how to compile and run panda from inside the Microsoft Visual Studio debugger.

Before you Begin

The first step is to download the panda source code and compile it. The instructions can be found in the section Building Panda from Source. Be sure to compile with the Optimize setting of 1, otherwise, Visual Studio will not be able to debug properly. Once you have compiled panda, start up visual studio, and ask it to create a new project:


There are four pieces of information you need to enter into the new project dialog:

  • Tell it to make a "C++ project"
  • Tell it to use a "Makefile"
  • Tell it the name of the project, "debugpanda"
  • Tell it where the panda source tree is (ie, "c:\panda3d-b")


Click ok, and confirm. You have now created the project, and the project is open for editing. You now need to access the "solution explorer:"


Normally, you can see the solution explorer in the upper-right corner of visual studio. It should show your project name (debugpanda). The word "debugpanda" needs to be highlighted - if it is not, click on it:


Now that your project is selected, you can edit its project properties:


The project property dialog initially looks like this. It contains three subpanels, the "General" panel, the "Debugging" panel, and the "NMake" subpanel. You can see these three subheadings in the left pane:


There is nothing to fill in on the general panel, so switch to the debugging panel. You need to fill in the command name, the command arguments, and the working directory. For now, we will ask it to debug the Actors/Robots sample program. Since visual studio puts the project file in a subdirectory, the paths need to be preceded by ".." to get to the root of the panda source tree:


Finally, switch to the "NMake" panel. Here, you can tell it what the command is to recompile panda. I use a bat file "mkp.bat" to compile panda. Since the project file is in a subdirectory, the command needs to be preceded by "cd .." in order to get back to the root of the panda source tree:


Visual studio now knows how to run panda, and how to compile it. You can run your program (in this case, the "Actors/Robots" tutorial) by clicking on the Debug menu:


You can rebuild panda at any time by clicking on the "Build" menu:


Now that you are running in the debugger, you can open any panda source file and set a breakpoint, or examine data. Of course, it may be advantageous to learn how to use the python debugger as well as the C++ debugger.