Using C++

I’m wondering if there is a standard way of using the Panda engine with C++. Can I just include some files, and link to certain libraries and get the same results as using Python? How more difficult would this be? Must I recompile the source to do this?

In principle, yes, that’s all you need to do–you just need to include the appropriate .h files to whatever parts of Panda you’re using, and link with the various .lib files. Although it shouldn’t be necessary to recompile Panda from source, it might not be a bad idea anyway, in case there are minor differences between the version of the compiler that you have and the one used by ETC; in any case, you should have the source available to you anyway so you can use it for reference.

You should be pretty handy at reading existing C++ code, or at least the comments in the C++ source, in order to get a good handle for how to use the C++ interfaces. I recommend starting with the pview source, in panda/src/testbed/pview.cxx, for a template “hello world” type application.


just to throw a word in, here’s the lines I use to build pview from msvc.

cl pview.cxx /I C:\Panda3d-1.1.0\include /LIBPATH:c:\Panda3d-1.1.0
lib libpanda -DWIN32_VC=1 -DWIN32=1 /GX /W3 /MD

link pview.obj /LIBPATH:C:\Panda3d-1.1.0\lib libpanda.lib libpandae
xpress.lib libframework.lib libdtool.lib libdtoolconfig.lib