undefined reference to `irrklang::createIrrKlangDevice

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
guardian2009
Posts: 3
Joined: Tue Feb 17, 2009 6:19 pm

undefined reference to `irrklang::createIrrKlangDevice

Post by guardian2009 »

Hi All

If this has been covered before, I apologize.. I did some searching, but the forum search did not seem to find anything relevant.


When trying to compile the CDEMO, I get this output:

Code: Select all

Makefile:33: Building...
g++ -I../../include -I/usr/X11R6/include -I/home/peter/workspace/irrKlang-1.1.3/include/ -Wall -O3 -ffast-math CDemo.o CMainMenu.o main.o -o ../../bin/Linux/Demo -L/home/peter/workspace/irrKlang-1.1.3/include/ -L/usr/X11R6/lib -L../../lib/Linux -lIrrlicht -lGL -lXext -lX11
^[^NCDemo.o: In function `CDemo::startIrrKlang()':
CDemo.cpp:(.text+0x4bb): undefined reference to `irrklang::createIrrKlangDevice(irrklang::E_SOUND_OUTPUT_DRIVER, int, char const*, char const*)'
collect2: ld returned 1 exit status
make: *** [all_linux] Error 1
As you can see, I'm in Linux, (Ubuntu 8.10)


I have irrKlang installed, and I have added the path to the makefile, notice its not complaining about not finding irrKlang.h

Any ideas?
Brkopac
Posts: 88
Joined: Fri Sep 19, 2008 2:36 am

Post by Brkopac »

You need to link into the irrKlang library. It would be something like -lirrKlang.
guardian2009
Posts: 3
Joined: Tue Feb 17, 2009 6:19 pm

Post by guardian2009 »

I found this in the MakeFile:

Code: Select all

# if you enable sound add the proper library for linking
#LDFLAGS += -lIrrKlang
#LDFLAGS += -laudiere
#LDFLAGS += -lSDL_mixer -lSDL

I uncommented:
LDFLAGS += -lIrrKlang

but still get the same issue..
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

The upper/lower case of the library has changed in one of the last versions, so you might have to check if you match with the actual libirrKlang.so or whatever casing it is.
guardian2009
Posts: 3
Joined: Tue Feb 17, 2009 6:19 pm

Post by guardian2009 »

I added

-L/home/peter/workspace/irrKlang-1.1.3/bin/linux-gcc

as that is where the .so file is located... but it still won't work.


I had this problem last year when I tried to use irrlicht for a project too, the reason then was irrKlang had a lot of calls changed, and the examples that came with irrlicht had not been updated...

Would it be easier to just forget using sound in the demos, and just work on the apps I want to develop, then implement sound later on?
Pyritie
Posts: 120
Joined: Fri Jan 16, 2009 12:59 pm
Contact:

Post by Pyritie »

guardian2009 wrote:Would it be easier to just forget using sound in the demos, and just work on the apps I want to develop, then implement sound later on?
We call this "procrastination". :wink:

Eh, if you want to put it off, go ahead. But you'll have to do it at some point. :P
Hive Workshop | deviantART

I've moved to Ogre.
Spkka
Posts: 32
Joined: Fri Jan 02, 2009 8:30 am

Post by Spkka »

Hmm im having the same problem in ubuntu using code::blocks. When i include -lIrrKlang in the linker settings it fine but i get to this error:
error while loading shared libraries: libIrrKlang.so: cannot open shared object file: No such file or directory

I found this but im not sure what to do?
If you copied libIrrKlang.so to /usr/local/lib then you need to be sure that directory is part of your shared library search path. Depending on your distribution - you may be able to add "/usr/local/lib" to /etc/ld.so.conf and then run ldconfig.

After you work that problem out, you're going to have another: I just noticed that I linked to the OIS shared library instead of the static one.
Spkka
Posts: 32
Joined: Fri Jan 02, 2009 8:30 am

Post by Spkka »

Fixed it after a chat with CuteAlien on irc. Cheers for that again.
Added this to the linker settings in "other linker options" ( code::blocks)
Wl,-rpath -Wl,./PATHTO.SO

Some of the options he gave:
1. Put it into your system library paths. Then run ldconfig which will check all system library paths and update its cache

2. Set LD_LIBRARY_PATH variable before staring your application to the folder where the library is in

3. Use an rpath as linker setting (see above I posted my line somewhere). That's a relative path to your working directoy which is searched on startup. Usually you add also a startscript then which is called instead of your library - because that allows you to have the workingdirectory similar to the path of the application binary. Or you can also set the LD_LIBRARY_PATH in that script.
Post Reply