Hi community!. I’m working with the PandaAi library, trying to implement some changes. The problem that i am facing is a segmentation fault, after adding just a variable of type double in the class AiCharacter, an initializing it in the constructor with an arbitrary number. The name of the variable is _elapTime. The code looks like this:
in aiCharacter.h:
class AICharacter {
public:
double _elapTime;
and in aiCharacter.cxx:
AICharacter::AICharacter(string model_name, NodePath model_np, double mass, double movt_force, double max_force) {
_elapTime = 0.0;
}
I was having also a segmentation fault working with variables allocated in the heap, using the malloc system call, but after reading this: panda3d.org/dox/python/html/ … l#_details
i started to fallback to the beginning of the development, and observed that the problem is still present under the simple declaration-initialization of that variable of type double. To compile the library i’m using all the steps of the compilation process of the entire Panda3D game engine: i extracted the flags of the call to interrogate, interrogate_module and g++ (to compile and link). I tried the process of compilation of the library without modifications, and it works fine. All the nightmare starts after adding my numeric variable. I am working under Ubuntu 11.10 64 bits. Does anybody have any idea about why i’m having such a segfault?, must i try first to learn how to debug with gdb that piece of code in c++ in order to obtain a trace of the segfault that will certainly make clear the error?. I have no idea of how to debug in this situation (my game is in python, and i need to debug a c++ library of Panda). I searched in the forum about that topic first, but i find some difficulties in order to understand the process of debugging in this setting. But, more important, there is no such a big piece of code to debug!. Thanks in advance!