Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am trying to create a custom IGUIElement in irrlicht, for that I have included the sources from irrlicht and extended the CIGUIStatictext class. Now whenever I try to compile my project, I get a host of linker errors, I must admit to ignorance of the compilation process and am not really able to figure out why this is happening. I'm including the source for both my header and cpp class as pastebin.

sample of the linker errors:

1>graphNode.obj : error LNK2019: unresolved external symbol "public: virtual__thiscall irr::gui::CGUIStaticText::~CGUIStaticText(void)" (??1CGUIStaticText@gui@irr@@UAE@XZ) referenced in function__unwindfunclet$??
    0graphNode@gui@irr@@QAE@PAVIGUIEnvironment@12@PAVIGUIElement@12@HV?$rect@H@core@2@PB_W@Z$0 1>graphNode.obj : error LNK2019: unresolved external symbol "public:__thiscall irr::gui::CGUIStaticText::CGUIStaticText
    (wchar_t const *,bool,class irr::gui::IGUIEnvironment *,class irr::gui::IGUIElement *,int,class irr::core::rect<int> const &,bool)" (??0CGUIStaticText@gui@irr@@QAE@PB_W_NPAVIGUIEnvironment@12@PAVIGUIElement@12@
    HABV?$rect@H@core@2@1@Z) referenced in function "public: __thiscall irr::gui::graphNode::graphNode(class irr::gui::IGUIEnvironment *,class irr::gui::IGUIElement *,int,class irr::core::rect<int>,wchar_t const*)"
    (??0graphNode@gui@irr@@QAE@PAVIGUIEnvironment@12@PAVIGUIElement@12@HV?$rect@H@core@2@PB_W@Z) 

1>graphNode.obj : error LNK2001: unresolved external symbol "public: virtual bool__thiscall irr::gui::graphNode::OnEvent(struct irr::SEvent const &)" (?OnEvent@graphNode@gui@irr@@UAE_NABUSEvent@3@@Z) 
1>graphNode.obj : error LNK2001: unresolved external symbol "public: virtual void__thiscall irr::gui::CGUIStaticText::updateAbsolutePosition(void)" (?updateAbsolutePosition@CGUIStaticText@gui@irr@@UAEXXZ) 
1>graphNode.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall irr::gui::CGUIStaticText::draw(void)" (?draw@CGUIStaticText@gui@irr@@UAEXXZ) 
1>graphNode.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall irr::gui::CGUIStaticText::setText(wchar_t const *)" (?setText@CGUIStaticText@gui@irr@@UAEXPB_W@Z)
share|improve this question
    
Could you show us the command (or cmake file) used to run your compilation please ? –  Valkea Mar 17 '12 at 2:08
add comment

1 Answer

It looks like your problem is that you haven't included the necessary libraries in your project. If you look at the distribution of irrlicht, there is a "lib" folder where you can find the appropriate library. You need to make sure this library "irrlicht.lib" is included under the projects link settings and that it is located in one of the paths that are searched for libraries (also a project setting).

It sounds like what you've done is add the file CGUIText to your project. You don't need to do that, that code exists in the library. If you just pick one class out of the source for that library, it will most likely not compile because it will depend on other classes in the library that you haven't included. You could integrate all of the source of the library into your project and use it that way, but there is no reason to do this unless you plan to heavily modify the library's source. You do want to include the header though, as you have.

A quick overview of building: There are two main steps, compiling and linking.

Compiling works on only one file at a time and one by one takes your cpp files and converts them into binary coded obj files. Some of these will reference objects in other files, in which case they are essentially given a place holder and the promise that it will be filled in by the next step.

Linking takes all of these obj files, as well as any additional libraries you are referencing and smashes them all together into the final executable. This includes taking all those "place holder" tags and filling in the actual address that those objects ended up at after everything was put together.

Those errors you are getting are essentially saying "you promised that these functions existed somewhere, but I looked through all the parts you gave me and I couldn't find them anywhere."

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.