Game Development Community

TGB Gui Browser

by Anthony · in Torque Game Engine · 07/29/2007 (12:51 am) · 1 replies

Excuse me for the long post, but it has been a year since I have touched c++ and VS .Net 2003.

I am trying to get the GuiBrowserCtrl to compile on TGE (it was written for TGB: http://www.mmoworkshop.com/trac/mom/wiki/TGBBrowser ). The code itself seems fine, but there are errors when linking that state there are multiple declarations of certain objects, but I can't seem to nail them down. here is the error log (took out a few of the repetitive errors):

Torque Demo error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z) already defined in guiBrowserCtrl.obj
Torque Demo error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)" (??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in guiBrowserCtrl.obj
Torque Demo error LNK2005: "public: char __thiscall std::basic_ios<char,struct std::char_traits<char> >::widen(char)const " (?widen@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEDD@Z) already defined in guiBrowserCtrl.obj
Torque Demo error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in guiBrowserCtrl.obj
Torque Demo error LNK2005: "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::operator=(char const *)" (??4?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@PBD@Z) already defined in libcpmt.lib(locale0.obj)

Now under project properties and additional dependencies I have put /NODEFAULTLIB:LIBCMT and when I do the same for libcpmt (only one listed there but there are around 5 or more), then I get 5 undefined object errors.

Here is the top of the GuiBrowserCtrl.cc file, maybe there are two headers or one that is clashing with a TGE one that is not needed (difference between TGB and TGE?). I heard that this was almost a direct port, was I wrong? Let me know if it is just something small and dumb that I am messing up on.

#include "console/console.h"
#include "console/consoleTypes.h"
#include "dgl/dgl.h"
#include "gui/core/guiControl.h"
#include "dgl/gTexManager.h"

#include "llmozlib.h"

//TODO: Remove Platform Dependency
#include <windows.h>
#include "platformWin32/platformWin32.h"

//TODO: Remove STL (in the hopes that Mozilla doesn't use STL, so we can enable TGB Memory Manager)
#include <string>
#include <vector>
#include <iostream>
#include <sstream>

#include <time.h>
#include <math.h>

//TODO: Move to proper header!
#define GL_BGR_EXT                        0x80E0
#define GL_BGRA_EXT                       0x80E1

Thanks for your help :)

#1
07/29/2007 (2:05 am)
I fixed the error.

Basically, for those who want to give it a shot, I downloaded the latest lib from ubrowser.com, and used that llmozlib instead :)

On note, the browser is very processor intensive, so my recommendation is that, start and end the browser in the places where you need it if you are using the object for tge. Reason being, is that it also seems the browser object, once clicked, takes all input, and you cannot use f10 or esc or any other key in the menu.

I will see if I can optimize this a bit and re-release it for you folks if there is enough interest.

Thanks again :)