Here is an example, I want to see the value of the variable sStringHandle declare at the beginning and watch it trought the process.
Ogre::String sStringHandle; <----------- BREAK POINT
#ifdef _WINDOW
sStringHandle = Ogre::StringConverter::toString((unsigned long)mpOgreCanvas->GetHandle())
#elif defined(__WXGTK__)
// TODO: Someone test this. you might to use "parentWindowHandle" if this
// does not work. Ogre 1.2 + Linux + GLX platform wants a string of the
// format display:screen:window, which has variable types ulong:uint:ulong.
GtkWidget* widget = (GtkWidget*)mpOgreCanvas->wxWindow::GetHandle();
gtk_widget_realize( widget ); // Mandatory. Otherwise, a segfault happens.
std::stringstream handleStream;
Display* display = GDK_WINDOW_XDISPLAY( widget->window );
Window wid = GDK_WINDOW_XWINDOW( widget->window ); // Window is a typedef for XID, which is a typedef for unsigned int
/* Get the right display (DisplayString() returns ":display.screen") */
std::string displayStr = DisplayString( display );
displayStr = displayStr.substr( 1, ( displayStr.find( ".", 0 ) - 1 ) );
/* Put all together */
handleStream << displayStr << ':' << DefaultScreen( display ) << ':' << wid;
sStringHandle = handleStream.str(); <----------- AFTER THIS LINE I SHOULD SEE THE VALUE
#else
#error Not supported on this platform.
#endif
Ogre::NameValuePairList tdParams;
tdParams["externalWindowHandle"] = sStringHandle;
I am in linux so the GTK part is running. The break point is at the sStringHandle's declaration and I debug trough each line but I always get: "Not simbol "sStringHandle" in the current context". I use namespaces in my project, should that be a problem??, here is the configuration for my cbp codeblocks project.
<Build>
<Target title="Debug">
<Option platforms="Unix;" />
<Option output="VisualApp" prefix_auto="1" extension_auto="1" />
<Option object_output="Debug" />
<Option type="0" />
<Option compiler="gcc" />
<Option projectLinkerOptionsRelation="2" />
<Compiler>
<Add option="-Wall" />
<Add option="-g" />
<Add option="`wx-config --cflags --debug=yes`" />
<Add option="`pkg-config OGRE --cflags`" />
<Add option="-Wno-deprecated" />
<Add option="-I ./Include" />
<Add option="-I ./Source" />
<Add option="-I /usr/include/gtk-2.0" />
<Add option="-I /usr/include/glib-2.0" />
<Add option="-I /usr/include/pango-1.0" />
<Add option="-I /usr/lib/glib-2.0/include" />
<Add option="-I /usr/lib/gtk-2.0/include" />
<Add option="-I /usr/include/atk-1.0/" />
<Add option="-I /usr/include/cairo/" />
<Add option="-D_DEBUG" />
</Compiler>
<Linker>
<Add option="`wx-config --libs`" />
<Add option="`pkg-config OGRE --libs`" />
<Add library="/usr/lib/libGL.so" />
</Linker>
</Target>
<Target title="Release">
<Option output="VisualApp" prefix_auto="1" extension_auto="1" />
<Option object_output="Release" />
<Option type="0" />
<Option compiler="gcc" />
</Target>
</Build>