Login
Username:

Password:

Remember me



Lost Password?

Register now!
Main Menu
H3D.org Feeds
H3D.org Forum Index
   Programming Issues
     Bug inside UI
Register To Post

Threaded | Newest First Previous Topic | Next Topic | Bottom
Poster Thread
adrian
Posted on: 2012/5/17 16:04
Quite a regular
Joined: 2010/6/16
From: Constanta, Romania
Posts: 31
Bug inside UI
Why is there a Frame class inside H3DLayoutInfoNode class ? When i include both "frame.h" and "gridinfo.h" I can't instantiate the Frame class. GridInfo includes "h3DLayoutInfoNode.h", which describes a Frame class. So, you get the "multiple definitions of a symbol" error;
Adi
Markus
Posted on: 2012/5/18 9:25
Webmaster
Joined: 2006/3/27
From: SenseGraphics
Posts: 1902
Re: Bug inside UI
I am guessing that that frame has been used in the header before, and then forgotten to be removed.
Does UI compile if you remove the "class Frame;" statement in H3DLayoutInfoNode.h?

And does it function as before?
adrian
Posted on: 2012/5/20 2:11
Quite a regular
Joined: 2010/6/16
From: Constanta, Romania
Posts: 31
Re: Bug inside UI
Yes it compiles. But I still have the problem that led me to finding that extra Frame class:
In main, I instantiate class ScenarioManager, that extends PeriodicUpdate. Inside ScenarioManager I instantiate the Frame class and I get errors:


1 error LNK2005: "public: __thiscall H3D::TypedSFNode<class H3D::H3DWidgetNode>::TypedSFNode<class H3D::H3DWidgetNode>(void)" (??0?$TypedSFNode@VH3DWidgetNode@H3D@@@H3D@@QAE@XZ) already defined in scenarioManager.obj UI_vc9_d.lib

2 error LNK2005: "public: virtual __thiscall H3D::TypedSFNode<class H3D::H3DWidgetNode>::~TypedSFNode<class H3D::H3DWidgetNode>(void)" (??1?$TypedSFNode@VH3DWidgetNode@H3D@@@H3D@@UAE@XZ) already defined in scenarioManager.obj UI_vc9_d.lib

3 fatal error LNK1169: one or more multiply defined symbols found D:\SVN_Workspace\app\trunk\Debug\exec_d.exe 1

it doesn't give any error for any other UI element instantiation.
If I create the a frame object inside main, it doesn't give any error.
I thought it would be from the files I included. these are the files included inside main:

#include <string>
#include <H3D/X3D.h>
#include <H3D/Scene.h>
#include <H3D/MouseSensor.h>
#include <H3D/Shape.h>
#include <H3D/GLUTWindow.h>

#include <H3D/StringSensor.h>
#include <H3D/Field.h>
#include <H3D/BooleanSequencer.h>
#include <H3D/TimeSensor.h>
#include <H3D/DeviceInfo.h>
#include <H3D/Group.h>
#include <H3D/SFVec3f.h>
#include <math.h>
#include "selectTaskScenario.h"
#include "menuManager.h"
#include "scenarioManager.h"


and the files included in ScenarioManager:
#include <H3D/X3D.h>
#include <H3D/PeriodicUpdate.h>
#include <H3D/MFString.h>
#include <H3D/Material.h>
#include <H3D/Transform.h>
#include <H3D/Shape.h>
#include <vector>
#include <H3D/IndexedTriangleSet.h>
#include <H3D/Coordinate.h>
#include <H3D/LineSet.h>
#include "scenario.h"


I deleted the Frame class from the H3DLayoutInfoNode class and recompiled it.I am using the right lib.


Few gallons of coke later edit: I tried everything that came to my mind. It doesn't make any sense. But, if I include one if: TouchButton.h and/or PopupMenu.h I get no error. I don't know why this is happening, but it works.
Markus
Posted on: 2012/5/21 9:56
Webmaster
Joined: 2006/3/27
From: SenseGraphics
Posts: 1902
Re: Bug inside UI
The reason is template-hell on windows at least.
The template class H3D::TypedSFNode<class H3D::H3DWidgetNode> is defined in a header file.
I am not good at explaining this fully but it is something like this. If the header that contains a template class is included in two places that have no relation to eachother then both tries to define that template class.
One "solution" to this is to make sure that every single template variation exists in a header file somewhere and to include this file whenever a variation of a template should be used. As you can see this is not always feasible.

Another solution is to figure out which class contains the "offending" template and structure your includes so you get rid of the error.
adrian
Posted on: 2012/5/22 10:10
Quite a regular
Joined: 2010/6/16
From: Constanta, Romania
Posts: 31
Re: Bug inside UI
Well, it works with those additional include files.
Thanks for the help :)
Threaded | Newest First Previous Topic | Next Topic | Top

Register To Post
 



(C) 2012 SenseGraphics AB    ---    Powered by XOOPS