C++ and librocket

Hi everybody,

Im new in panda3d (actualy this is my first game experience)

Im trying to make a gui with librocket (using vs 2008 pro in win7).

when i add “#include “rocketRegion.h”” line compiler say;

rocketRenderInterface.h(25) : fatal error C1083: Cannot open include file: 'Rocket/Core/RenderInterface.h': No such file or directory

and when i copy the Rocket folder from parser-inc to include its say:

rocketRenderInterface.h(32) : error C2504: 'Rocket::Core::RenderInterface' : base class undefined
rocketRenderInterface.h(72) : error C2079: 'RocketRenderInterface::_dimensions' uses undefined class 'Rocket::Core::Vector2i'

even i added “libp3rocket.lib” to dependencies but nothing change.
(i did not copy orginal librocket include folder)

Can somebody help me about librocket in c++ (vs 2008)?
Edit: im using panda sdk 1.8.0

Thanxx :blush:

Linking the lib has no influence over those kind of errors (these are compile-time errors, linking only affects the linking part, which comes right after the compiling).

I think there is something wrong with the way you set your include paths.
Obviously Rocket does not expect this. You don’t need to copy anything: you need to have a folder that looks like this:

myfolder/
  Rocket/
    rocketRenderInterface.h
    [and so on]

And you need to add to your include paths the path to myfolder, not the path to Rocket.
And when you include your files, you need to do:
#include <Rocket/rocketRegion.h>
instead of
#include “rocketRegion.h”

It’s the easiest and best way to do this.

The mistake was to copy files from parser-inc. You should never include the files from parser-inc. Instead, download the Panda3D thirdparty packages from the download page and use the libRocket include files from there.

thanx rdb i can build with thirdparty package.

i included

libp3rocket.lib
RocketControls.lib
RocketCore.lib
RocketDebugger.lib

But this time i have crash problem :frowning:

Is somebody have a working sample with librocket?

my code:

#include "pandaFramework.h" 
#include "rocketRegion.h" 
#include "Rocket/Core.h" 

int main(int argc, char *argv[]) { 
    PandaFramework framework; 
    framework.open_framework(argc, argv); 
    framework.set_window_title("My Panda3D Rockettest Window"); 
      
   WindowFramework *window = framework.open_window(); 

   Rocket::Core::FontDatabase::LoadFontFace("assets/Delicious-Roman.otf"); 

   PT(RocketRegion) rocketRegion = RocketRegion::make("PandaRocketRegion",window->get_graphics_output()); 

   PT(RocketInputHandler) rih = new RocketInputHandler(); 
   window->get_mouse().attach_new_node(rih); 
   rocketRegion->set_input_handler(rih); 
    
   Rocket::Core::ElementDocument* document = rocketRegion->get_context()->LoadDocument("data/main_menu.rml"); 
   document->Show(); 

   framework.main_loop(); 
   framework.close_framework();

   return (0); 
 }

and error output:

First-chance exception at 0x1e0d4533 in RocketTest.exe: 0xC0000005: Access violation reading location 0x00000004.
Unhandled exception at 0x773915de in RocketTest.exe: 0xC0000005: Access violation reading location 0x00000004.

Thanxx

I think you may need to include Python.h and call Py_Initialize().

Do what rdb said. I made a minimal C++ librocket example here: link