Author Topic: Adding DB Access to Orbiter  (Read 2702 times)


  • Douchebag
  • Addicted
  • *
  • Posts: 567
    • View Profile
Adding DB Access to Orbiter
« on: February 04, 2008, 10:08:01 am »
I'm trying to add database access to the Orbiter. Specifically, I'm trying to add it to the ScreenHandler class, where it sends the Bulk Rip message to the Powerfile_C200 in ScreenHandler::JukeboxManager_ObjectSelected() , to get the rip target format defaults. So I'm trying to add a database connection to the ScreenHandler constructor, which can be queried later in the code right before composing the message to be sent. But I'm having problems just adding a database object to the ScreenHandler class.

I'm modeling the code on the WizardLogic.cpp code that does the same thing. I'd reuse the WizardLogic code and its DB querying functions, but AFAICT the WizardLogic has an Orbiter, but there's no backward reference to the WizardLogic in the Orbiter, that the ScreenHandler could get from the ScreenHandler::Orbiter . So I just try to add a Database_pluto_main * member to the ScreenHandler , as a protected member Database_pluto_main *m_pDatabase_pluto_main; in ScreenHandler.h , and m_pDatabase_pluto_main = new Database_pluto_main(LoggerWrapper::GetInstance()); in ScreenHandler.cpp . I add #include "pluto_main/Database_pluto_main.h" to each of ScreenHandler.{cpp,h} .

But when I (cd src; make all) , I get

Code: [Select]
../Orbiter/ScreenHandler.o: In function `ScreenHandler':
/opt/lmce/src/Bluetooth_Dongle/../Orbiter/ScreenHandler.cpp:69: undefined reference to `Database_pluto_main::Database_pluto_main(DCE::Logger*)'
/opt/lmce/src/Bluetooth_Dongle/../Orbiter/ScreenHandler.cpp:69: undefined reference to `Database_pluto_main::Database_pluto_main(DCE::Logger*)'
collect2: ld returned 1 exit status
make[1]: *** [Bluetooth_Dongle] Error 1
make[1]: Leaving directory `/opt/lmce/src/Bluetooth_Dongle'
(FWIW, the Makefiles requiring rebuilding dozens of object files when only ScreenHandler.cpp changes is a real hassle. And what's Bluetooth_Dongle doing rebuilding the ScreenHandler when only the ScreenHandler has changed?)
As a test, I change the ScreenHandler.h declaration to int m_pDatabase_pluto_main; and then in ScreenHandler.cpp I replace the creation of the new Database_pluto_main with just m_pDatabase_pluto_main = 32; . When I (cd src; make all) , it compiles and links without complaint.

I don't know why the linker isn't finding the definition of  Database_pluto_main in pluto_main/Database_pluto_main.h as #included in ScreenHandler.h .

Any ideas?