Only python, C++ is not working ( Ubuntu 9.10 )

Hello everyone.
I just downloaded panda3d (.deb for 1.7) today and I’m very excited to learn about it.

The problem I’m having is that only python (2.6) works, I can’t compile with g++(4.4.1). I’m trying the first hello world app in the manual and it doesn’t work… here is the log.

arbosis@mercurius ~/Projects/Panda3d > g++ HelloWorld.cxx -o HelloWorld.o -fPIC -I/usr/include/python2.6/ -I/usr/include/panda3d
/tmp/ccBAmU3L.o: In function `main':                                                                                            
HelloWorld.cxx:(.text+0x2f): undefined reference to `PandaFramework::open_framework(int&, char**&)'                             
HelloWorld.cxx:(.text+0xad): undefined reference to `PandaFramework::open_window()'                                             
HelloWorld.cxx:(.text+0xbf): undefined reference to `PandaFramework::main_loop()'                                               
HelloWorld.cxx:(.text+0xcd): undefined reference to `PandaFramework::close_framework()'                                         
/tmp/ccBAmU3L.o: In function `__static_initialization_and_destruction_0(int, int)':                                             
HelloWorld.cxx:(.text+0x1d5): undefined reference to `PandaFramework::PandaFramework()'                                         
HelloWorld.cxx:(.text+0x1db): undefined reference to `PandaFramework::~PandaFramework()'                                        
/tmp/ccBAmU3L.o: In function `MemoryBase::operator delete(void*)':                                                              
HelloWorld.cxx:(.text._ZN10MemoryBasedlEPv[MemoryBase::operator delete(void*)]+0x14): undefined reference to `memory_hook'      
HelloWorld.cxx:(.text._ZN10MemoryBasedlEPv[MemoryBase::operator delete(void*)]+0x23): undefined reference to `memory_hook'      
/tmp/ccBAmU3L.o: In function `register_type(TypeHandle&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, TypeHandle)':
HelloWorld.cxx:(.text._Z13register_typeR10TypeHandleRKSsS_[register_type(TypeHandle&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, TypeHandle)]+0x13): undefined reference to `TypeRegistry::ptr()'                                                                                                                                                               
HelloWorld.cxx:(.text._Z13register_typeR10TypeHandleRKSsS_[register_type(TypeHandle&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, TypeHandle)]+0x29): undefined reference to `TypeRegistry::register_type(TypeHandle&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'                                                           
HelloWorld.cxx:(.text._Z13register_typeR10TypeHandleRKSsS_[register_type(TypeHandle&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, TypeHandle)]+0x56): undefined reference to `TypeRegistry::ptr()'                                                                                                                                                               
HelloWorld.cxx:(.text._Z13register_typeR10TypeHandleRKSsS_[register_type(TypeHandle&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, TypeHandle)]+0x6c): undefined reference to `TypeRegistry::record_derivation(TypeHandle, TypeHandle)'                                                                                                                           
/tmp/ccBAmU3L.o: In function `TypedObject::get_class_type()':                                                                                                                                     
HelloWorld.cxx:(.text._ZN11TypedObject14get_class_typeEv[TypedObject::get_class_type()]+0x1a): undefined reference to `TypedObject::_type_handle'                                                 
/tmp/ccBAmU3L.o: In function `Socket_IP::get_class_type()':                                                                                                                                       
HelloWorld.cxx:(.text._ZN9Socket_IP14get_class_typeEv[Socket_IP::get_class_type()]+0x1a): undefined reference to `Socket_IP::_type_handle'                                                        
/tmp/ccBAmU3L.o: In function `Socket_IP::init_type()':                                                                                                                                            
HelloWorld.cxx:(.text._ZN9Socket_IP9init_typeEv[Socket_IP::init_type()]+0x15): undefined reference to `TypedObject::init_type()'                                                                  
HelloWorld.cxx:(.text._ZN9Socket_IP9init_typeEv[Socket_IP::init_type()]+0x5e): undefined reference to `Socket_IP::_type_handle'                                                                   
/tmp/ccBAmU3L.o: In function `Socket_IP::~Socket_IP()':
HelloWorld.cxx:(.text._ZN9Socket_IPD1Ev[Socket_IP::~Socket_IP()]+0x34): undefined reference to `TypedObject::~TypedObject()'
HelloWorld.cxx:(.text._ZN9Socket_IPD1Ev[Socket_IP::~Socket_IP()]+0x4e): undefined reference to `TypedObject::~TypedObject()'
/tmp/ccBAmU3L.o: In function `Socket_IP::~Socket_IP()':
HelloWorld.cxx:(.text._ZN9Socket_IPD0Ev[Socket_IP::~Socket_IP()]+0x34): undefined reference to `TypedObject::~TypedObject()'
HelloWorld.cxx:(.text._ZN9Socket_IPD0Ev[Socket_IP::~Socket_IP()]+0x4e): undefined reference to `TypedObject::~TypedObject()'
/tmp/ccBAmU3L.o: In function `BitMask<unsigned int, 32>::set_bit(int)':
HelloWorld.cxx:(.text._ZN7BitMaskIjLi32EE7set_bitEi[BitMask<unsigned int, 32>::set_bit(int)]+0x21): undefined reference to `Notify::ptr()'
HelloWorld.cxx:(.text._ZN7BitMaskIjLi32EE7set_bitEi[BitMask<unsigned int, 32>::set_bit(int)]+0x45): undefined reference to `Notify::assert_failure(char const*, int, char const*)'
/tmp/ccBAmU3L.o:(.data.rel.ro._ZTI9Socket_IP[typeinfo for Socket_IP]+0x8): undefined reference to `typeinfo for TypedObject'
collect2: ld returned 1 exit status

I also tried to compile panda3d from source but I had problems with that too.

I’d be very happy if anyone could help me :slight_smile:

You need to link it to the Panda libraries. Add something like “-lp3framework -lp3pystub -lpanda” to the command-line, and the linker path “-L/usr/lib/panda3d”.

I’v tried with " g++ HelloWorld.cxx -o HelloWorld.o -fPIC -I/usr/include/python2.6/ -I/usr/include/panda3d -lp3framework -lp3pystub -lpanda -L/usr/lib/panda3d " and it seems that it is working !

Thanks you for answering my noob question :slight_smile: