View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# Getting an error when I compile Irrlicht

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

7 replies to this topic

### #1Aluthreney  Members

Posted 28 February 2012 - 02:20 PM

I just started using Irrlicht and when I compile the program it gives me this error: cannot find -lirrlicht.
Theres no point in posting the code because I all have are the iostream and irrlicht.h includes and the main function returning 0.

IDE: Code::Blocks
Irrlicht: 1.7.3
OS: Ubuntu 10.11

I've searched online, but I couldn't find an answer.

Aluthreney -- the King of sheep.

### #2e‍dd  Members

Posted 28 February 2012 - 03:01 PM

Where is libirrlicht(.a/.so/...)? You need to point the linker to it. Pass "-L <path-to-your-libs>" on the command line to do this. There's probably something in one of the Code::Blocks dialogs to set this via a GUI.

I said this in the other thread, but I'll say it again here for you in bold: Now's a really good time to read up on the C and C++ compilation model. Once you have a good understanding of that, fixing problems such these becomes very easy.

### #3Aluthreney  Members

Posted 28 February 2012 - 04:06 PM

Thanks for the answer, I was able to solve the problem. And thank you for your advice, I'll look into it.

Aluthreney -- the King of sheep.

### #4Aluthreney  Members

Posted 29 February 2012 - 08:38 AM

I just started following a tutorial and this is the code I added to my program:

IrrlichtDevice *device=createDevice(EDT_OPENGL, dimension2d<u32> (640, 480), 16, false, false, false, 0);

if(!device)
{
return 1;
}

and for the past two hours I've been looking for some way to solve these errors:

/usr/lib/libIrrlicht.a(CIrrDeviceLinux.o)||In function ~CIrrDeviceLinux':|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|131|undefined reference to XFree'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|141|undefined reference to glXMakeContextCurrent'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|146|undefined reference to glXMakeCurrent'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|149|undefined reference to glXDestroyContext'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|151|undefined reference to glXDestroyWindow'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|163|undefined reference to XDestroyWindow'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|164|undefined reference to XCloseDisplay'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|168|undefined reference to XFree'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|131|undefined reference to XFree'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|141|undefined reference to glXMakeContextCurrent'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|146|undefined reference to glXMakeCurrent'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|149|undefined reference to glXDestroyContext'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|151|undefined reference to glXDestroyWindow'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|163|undefined reference to XDestroyWindow'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|164|undefined reference to XCloseDisplay'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|168|undefined reference to XFree'|
/usr/lib/libIrrlicht.a(CIrrDeviceLinux.o)||In function irr::IrrPrintXError(_XDisplay*, XErrorEvent*)':|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|191|undefined reference to XGetErrorDatabaseText'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|192|undefined reference to XGetErrorText'|
/usr/lib/libIrrlicht.a(CIrrDeviceLinux.o)||In function irr::CIrrDeviceLinux::switchToFullscreen(bool)':|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|209|undefined reference to XF86VidModeSwitchToMode'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|210|undefined reference to XF86VidModeSetViewPort'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|231|undefined reference to XF86VidModeQueryExtension'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|237|undefined reference to XF86VidModeGetAllModeLines'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|257|undefined reference to XF86VidModeSwitchToMode'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|258|undefined reference to XF86VidModeSetViewPort'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|267|undefined reference to XFree'|
/usr/lib/libIrrlicht.a(CIrrDeviceLinux.o)||In function irr::CIrrDeviceLinux::createWindow()':|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|346|undefined reference to XSetErrorHandler'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|349|undefined reference to XOpenDisplay'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|353|undefined reference to XDisplayName'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|354|undefined reference to XDisplayName'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|371|undefined reference to glXQueryExtension'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|372|undefined reference to glXQueryVersion'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|521|undefined reference to XFree'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|554|undefined reference to glXChooseVisual'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|562|undefined reference to glXChooseVisual'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|568|undefined reference to glXChooseVisual'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|593|undefined reference to XGetVisualInfo'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|601|undefined reference to XCloseDisplay'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|614|undefined reference to XCreateColormap'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|634|undefined reference to XCreateWindow'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|635|undefined reference to XMapRaised'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|638|undefined reference to XInternAtom'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|639|undefined reference to XSetWMProtocols'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|642|undefined reference to XSetInputFocus'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|644|undefined reference to XGrabKeyboard'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|647|undefined reference to XGrabPointer'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|649|undefined reference to XWarpPointer'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|663|undefined reference to XCreateWindow'|
/home/michael/irrlicht-1.7.3/source/Irrlicht/CIrrDeviceLinux.cpp|666|undefined reference to XGetWindowAttributes'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 0 warnings ===|

From what I've read online it doesn't seem to be an error related to irrlicht itself. I'll keep looking, but if anybody knows anything about this I'd appreciate the help.

Aluthreney -- the King of sheep.

### #5Jeffreyp  Members

Posted 29 February 2012 - 01:52 PM

Did you add the irrlicht lib?
A fast way :

#pragma comment(lib, "irrlicht.lib") // Or irr.lib can't remember



### #6e‍dd  Members

Posted 29 February 2012 - 08:54 PM

Which libraries contain those symbols? You will need to tell your linker about them, either by adding them on the command line, or by setting the appropriate option in the Code::Blocks GUI.

I guess you might need something like libx11 and libglx, but I don't have a Linux system handy to check their names.

This is another very common, easily solvable linker error. You will encounter this problem time and time again. They are very easy to fix with a little bit of knowledge. So, one last time, after which I give up: Now's a really good time to read up on the C and C++ compilation model. Once you have a good understanding of that, fixing problems such these becomes very easy.

### #7Aluthreney  Members

Posted 01 March 2012 - 03:27 AM

#pragma comment(lib, "irrlicht.lib") // Or irr.lib can't remember


That line of code is only used if your using Microsoft Visual Studio. I'm using Code::Blocks.

So, one last time, after which I give up: Now's a really good time to read up on the C and C++ compilation model. Once you have a good understanding of that, fixing problems such these becomes very easy.

Aluthreney -- the King of sheep.

### #8e‍dd  Members

Posted 01 March 2012 - 06:45 AM