Deriving class from IGUIWindow

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
miko93
Posts: 54
Joined: Sat Nov 12, 2005 5:24 pm
Location: Regensburg, Germany
Contact:

Deriving class from IGUIWindow

Post by miko93 »

Sirs,

I'm on to deriving my own class from IGUIWindow, trying to do it similar to the tutorial3 (http://irrlicht.sourceforge.net/tut003.html). My class so far looks like this:

Code: Select all

// infowindow.h

#pragma once

class CInfoWindow: public irr::gui::IGUIWindow
{
public:
	CInfoWindow(irr::gui::IGUIEnvironment *env, irr::s32 id, irr::core::rect<irr::s32> rec);
	~CInfoWindow(void);

	virtual irr::gui::IGUIButton* getCloseButton(void);
	virtual irr::gui::IGUIButton* getMinimizeButton(void);
	virtual irr::gui::IGUIButton* getMaximizeButton(void);
};

Code: Select all

// infowindow.cpp

#include "globals.h"

CInfoWindow::CInfoWindow(irr::gui::IGUIEnvironment *env, 
						 irr::s32 id, irr::core::rect<irr::s32> rec):
						 irr::gui::IGUIWindow(env, env->getRootGUIElement(), id, rec)
{}

CInfoWindow::~CInfoWindow(void)
{}

irr::gui::IGUIButton* CInfoWindow::getCloseButton(void)
{return(irr::gui::IGUIWindow::getCloseButton());}

irr::gui::IGUIButton* CInfoWindow::getMinimizeButton(void)
{return(irr::gui::IGUIWindow::getMinimizeButton());}

irr::gui::IGUIButton* CInfoWindow::getMaximizeButton(void)
{return(irr::gui::IGUIWindow::getMaximizeButton());}
Sadly enough, I get a linker error for the irr::gui::IGUIWindow::... routines (getCloseButton, getMinimizeButton, getMaximizeButton) like this
infowindow.obj : error LNK2019: Not resolved external symbol '"public: virtual class irr::gui::IGUIButton * __thiscall irr::gui::IGUIWindow::getCloseButton(void)" ...
I understand I'm missing something here (well, maybe missing the concept completely). Someone to enlighten me? Thank you very much.

miko
"Yessir, I'll be happy to make these unnecessary changes to this irrelevant document." (Dilbert)
AshmenGlue
Posts: 29
Joined: Wed Oct 12, 2005 9:09 am

Post by AshmenGlue »

Maybe I could be wrong but you could try including the header file to IGUIButton since if I'm not wrong, the error apparently is cause there is some linking problem with this line :

virtual irr::gui::IGUIButton* getCloseButton(void);
bearSoft
Posts: 165
Joined: Fri Apr 01, 2005 9:55 pm
Location: Denmark

Post by bearSoft »

is this std cpp....??
then, In any prototype u do not use the syntax
...........(void);
void is reserved for -returns- of 'nothing' eg

Code: Select all

void myFunc(int ii){
 GlobalVar=MYKONS+ii;
} 
saying that 'myFunc' is an 'internal calculation thingie' that does not -return- anything but it recieves the -argument- ii as the formal parameter. (the function is rubbish..)

In ur case it should simply be
~CInfoWindow(); //nothing in the paranteese
Saying that this does not take any -arguments-

Yesterday i linked to several c++ tut sites -u may like to look at those[/code]
Regards.
Tech: win98se| 320mb ram| abitbe6| 433mhzceleron| atiRadeon7000.64mb| soundblaster125| dx9.0b | devCPP | IRR 0.12.0 |
Dark Rain
Posts: 47
Joined: Thu Jul 07, 2005 1:31 am

Post by Dark Rain »

Things like "CInfoWindow(void)" are generated by default by ide like MSVS 2005 now. I too wasn't certain it was standard C++ at first but then it's true that int main(void) is something I used to see very often in C++ tutorials back in the days. I digged a bit further and the C++ reference says it's valid from the way I read it :
Void can also be used to declare an empty parameter list.
C++ reference url : http://www.cppreference.com/keywords/void.html
Guest

Post by Guest »

The problem is that you are trying to invoke the abstract methods of the IGUIWindow interface. To do what you want, you would have to inherit from CGUIWindow.
miko93
Posts: 54
Joined: Sat Nov 12, 2005 5:24 pm
Location: Regensburg, Germany
Contact:

Post by miko93 »

Thank you all for your input.
The problem is that you are trying to invoke the abstract methods of the IGUIWindow interface. To do what you want, you would have to inherit from CGUIWindow.
Yeah, I think that is it. Seems I missed the concept a bit. :roll:
What I will do now is add the CGUIWindow class source to my project, then derive an own class from it. This should work, IMHO.

Again, thanks.
"Yessir, I'll be happy to make these unnecessary changes to this irrelevant document." (Dilbert)
MikeR
Posts: 767
Joined: Sun Dec 26, 2004 4:03 pm
Location: Northern California USA
Contact:

Post by MikeR »

What I will do now is add the CGUIWindow class source to my project
You don't need to move the source file. Just #include it in your own file and derive from it's functions.
If it exists in the real world, it can be created in 3d

Sys specs:
AMD 3700+ 64 processor
1.0 gb ram
e-Geforce 6600 graphics 256 mb onboard ram
Post Reply