• Advertisement
Sign in to follow this  

Getting an error when I compile Irrlicht

This topic is 2152 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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|378|undefined reference to `glXGetProcAddress'|
/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|525|undefined reference to `glXGetProcAddress'|
/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.smile.png

Share this post


Link to post
Share on other sites
Did you add the irrlicht lib?
A fast way :
[source]
#pragma comment(lib, "irrlicht.lib") // Or irr.lib can't remember
[/source]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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


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.


Well, could you please give me a book title that talks about this or maybe a website name...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement