This short guide explains how to build a Panda3D game written in C++ game under Linux. If you use Python for programming, you can skip this page.
For the Windows version of this guide, click here.
First of all, download the following files:
- Python
- The thirdparty package, downloadable from the Downloads section
- The GNU G++ compiler. On most Linux versions, this is already pre-installed.
Now, first of all, we need to create a .o file from our cxx file. We need to link to the NSPR include files, to the Panda3D include files and to the Python include files. Please change the paths in these commands to the appropiate locations.
g++ -c filename.cxx -o filename.o -fPIC -O2 -I{pythoninclude} -I{thirdparty}/linux-libs-a/nspr/include -I{panda3dinclude}
|
To generate an executable, you can use the following command:
g++ filename.o -o filename -fPIC -L{panda3dlibs} -L{x11libs} -lp3framework -lpanda -lpandafx -lpandaexpress -lp3dtoolconfig -lp3dtool -lp3pystub -L{thirdparty}/linux-libs-a/nspr/lib -lpandanspr4
|
Note: In this two commands, you need to change a few paths:
- {pythoninclude}: The path to your Python include folder. For version 2.4, this is /usr/include/python2.4 by default.
- {panda3dinclude}: Change this to the path to your Panda3D include directory
- {thirdparty}: Change this to the path to your thirdparty directory. You can download the thirdparty package from the Downloads page.
- {panda3dlibs}: Change this to the path to your Panda3D libraries. Usually this is just /usr/lib.
- {x11libs}: The path to your X11 libraries. E.g. for X11R6 this is /usr/X11R6/lib by default.
To run your newly created executable, type:
And behold, your own Panda3D program!
|