[Solved] Codeblocks: Undefined reference to IdenMatrix

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
rubenwardy
Posts: 91
Joined: Mon Mar 05, 2012 4:51 pm
Location: Bristol, UK
Contact:

[Solved] Codeblocks: Undefined reference to IdenMatrix

Post by rubenwardy »

>> Codeblocks: Undefined reference to irr4core14IdentityMatrixE

I have done the include and lib folder in build options > search directories, and added irrlicht.lib to build options > linker. Dll is in the output folder.

Code: Select all

-------------- Build: Debug in prog ---------------
 
Linking console executable: bin\Debug\prog.exe
obj\Debug\SRC\Editor.o: In function `ZN3irr5video14SMaterialLayer16getTextureMatrixEv':
path/irrlicht-1.8/irrlicht-1.8/include/SMaterialLayer.h:127: undefined reference to `_imp___ZN3irr4core14IdentityMatrixE'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 1 seconds)
1 errors, 0 warnings
Writing a program that just opens an irrlicht window compiles.

Here is editor.cpp

http://pastebin.com/zDxyQgik
Last edited by rubenwardy on Fri Oct 04, 2013 11:00 am, edited 1 time in total.
rubenwardy
Posts: 91
Joined: Mon Mar 05, 2012 4:51 pm
Location: Bristol, UK
Contact:

Re: Codeblocks: Undefined reference to irr4core14IdentityMat

Post by rubenwardy »

I have isolated the problem

Code: Select all

void Editor::Load_Scene(){
    matrix4 projMat;
    irr::f32 orth_w = (float)driver->getScreenSize().Width / (float)driver->getScreenSize().Height;
    orth_w = 3 * orth_w;
    projMat.buildProjectionMatrixOrthoLH(orth_w,3,1,100);
 
    // Create target
    target = smgr->addEmptySceneNode(0,200);
    target->setPosition(vector3df(0,0,0));
 
    // Add rotational camera
    pivot=smgr->addEmptySceneNode(target,199);
    camera[0]=smgr->addCameraSceneNode(NULL,vector3df(0,0,-2),vector3df(0,0,0));
    camera[0]->setParent(pivot);
    pivot->setRotation(vector3df(25,-45,0));
 
    // Add Topdown camera
    camera[1]=smgr->addCameraSceneNode(target,vector3df(0,2,-0.01),vector3df(0,0,0));
    camera[1]->setProjectionMatrix(projMat,true);
 
    // Add front camera
    camera[2]=smgr->addCameraSceneNode(target,vector3df(0,0,-5),vector3df(0,0,0));
    camera[2]->setProjectionMatrix(projMat,true);
 
    // Add side camera
    camera[3]=smgr->addCameraSceneNode(target,vector3df(-5,0,0));
    camera[3]->setProjectionMatrix(projMat,true);
 
    // Add Light
    ILightSceneNode* light=smgr->addLightSceneNode(target,vector3df(25,50,0));
    light->setLightType(ELT_POINT);
    light->setRadius(2000);
 
    // Add Plane
    IMeshSceneNode* plane = smgr->addCubeSceneNode(1,0,-1,vector3df(0.5,-5.5,0.5),vector3df(0,0,0),vector3df(10,10,10));
    plane->setMaterialTexture(0, driver->getTexture("texture_terrain.png"));
    plane->setMaterialFlag(video::EMF_BILINEAR_FILTER, false);
    plane->getMaterial(0).getTextureMatrix(0).setTextureScale(10,10);
 
    // Add sky box
    scene::IMeshSceneNode* skybox=smgr->addCubeSceneNode(50);
    skybox->setMaterialTexture(0, driver->getTexture("sky.jpg"));
    skybox->setMaterialFlag(video::EMF_BILINEAR_FILTER, false);
    skybox->setMaterialFlag(video::EMF_LIGHTING,false);
    smgr->getMeshManipulator()->flipSurfaces(skybox->getMesh());
    plane_tri=smgr->createOctreeTriangleSelector(skybox->getMesh(),skybox);
}
Commenting this out causes the program to compile correctly.
More specifically, plane->getMaterial(0).getTextureMatrix(0).setTextureScale(10,10); is the problem.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Codeblocks: Undefined reference to irr4core14IdentityMat

Post by CuteAlien »

The problem is usually when you link Irrlicht statically but don't tell your client it's linked statically. When linking static you have to set _IRR_STATIC_LIB_ in your preprocessor definitions.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
rubenwardy
Posts: 91
Joined: Mon Mar 05, 2012 4:51 pm
Location: Bristol, UK
Contact:

Re: Codeblocks: Undefined reference to irr4core14IdentityMat

Post by rubenwardy »

Thank you, this fixes the problem.
Post Reply