[Solved]Linking problem - OgreAL::check(...)

OgreUser

27-10-2007 13:37:19

Hi there,

I'm trying to compile OgreAL on MVC++.
Everything went well, ogg, vorbis, OpenALSDK, got alut binaries... but when I try to compile OgreAL, i get this errror during linking:

Linking...
Creating library C:\Zone\OGRE\Ogre_Projects\OgreAL\lib\Debug\OgreAL_d.lib and object C:\Zone\OGRE\Ogre_Projects\OgreAL\lib\Debug\OgreAL_d.exp
LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library
OgreALOggSound.obj : error LNK2019: unresolved external symbol "void __cdecl OgreAL::check(bool,int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?check@OgreAL@@YAX_NHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@1@Z) in fonction "protected: __thiscall OgreAL::OggSound::OggSound(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,bool,enum OgreAL::AudioFormat)" (??0OggSound@OgreAL@@IAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0_NW4AudioFormat@1@@Z)
OgreALWavSound.obj : error LNK2019: unresolved external symbol "void __cdecl OgreAL::check(bool,int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?check@OgreAL@@YAX_NHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@1@Z) in fonction "protected: __thiscall OgreAL::WavSound::WavSound(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,bool,enum OgreAL::AudioFormat)" (??0WavSound@OgreAL@@IAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0_NW4AudioFormat@1@@Z)
C:\Zone\OGRE\Ogre_Projects\OgreAL\lib\Debug\OgreAL_d.dll : fatal error LNK1120: 1 unresolved externals


I found a very similar thread, solved by fixing the "visitRenderables" function it seems, while mine would be "OgreAL::check".

http://www.ogre3d.org/phpBB2addons/view ... gsound+obj

I'm building againt 1.4.5 Eihort with the latest OgreAL CVS.


Should I roll back to a previous version ?
I already tried to build myself alut lib, but same error. There's a thread from Casey saying that alut isnt required anymore, what must be done for that ?

Thanks for any help,

OgreUser

Aquatix

27-10-2007 15:21:17

got alut binaries...
Something's clearly wrong here! OgreAL no longer requieres ALUT.
Basically, what that means, is that you don't need to download that anymore.

OgreUser

27-10-2007 18:43:55

That's weird. I got OgreAL from svn, and I still need ALut.lib :(

Aquatix

27-10-2007 19:46:08

No you don't actually. This can just be a left-over in the solution. Just remove that line.

CaseyB

27-10-2007 21:07:07

I just commited OgreALException.h/.pp again. I think I forgot to commit them after a change, please try again and let me know if that helps. Also I don't see anything relating to alut in your errors there, I double checked the project files and it is really gone so if you see it mentioned in your output, let me know that too.

OgreUser

27-10-2007 22:49:56

Thanks for your answers, I don't need alut indeed :roll:

But the error persists with the OgreAL:check() function called in OgreALOggSound.cpp and OgreALWavSound.cpp.

I have no clue of what's involved in this problem :?

Edit : I commented all the OgreAL::check() calls to check, and it compiled. But that's not an decent solution..
Moreover, I still get that warning concerning a conflict between two libraries : default "LIBCMTD' and others :

LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library

CaseyB

28-10-2007 01:30:23

I am not sure what the problem is with OgreAL::check(), is anyone else having problems?

Also, I fixed the warning. I had seen it before, but ignored it since it was just a warning, you prompted me to look deeper into it and I found this [u]page on MSDN[/u]. Thanks!

Aquatix

28-10-2007 02:19:22

@OgreUser:
Well, seems like something is still wrong with the libraries you use. So, below what I did was to take a snapshot of the current version from SVN, and add there ogg and vorbis libs, fixed the MVS files. All you need is to have 2 environment variables: "OGRE_HOME" and "OPENAL_SDK". The 2nd one you'll get when you download and install OpenAL SDK (use google, forgot the exact link). So, download OpenAL, then OgreAL via a link below and try to compile. Should be easy enough.

@CaseyB:
Please check up this setup, maybe you would agree that this way it is somewhat easier (or actually much easier) for people to build, if they already have all dependancies apart from Ogre and OpenAL.

The link: http://rapidshare.com/files/65679119/OgreAL_alternative_build.rar

P.S. about that warning - actually I've seen it before, so all you do is put where the command line is, something like "/NODEFAULTLIB:libcmt.lib" or "/NODEFAULTLIB:msvcrt.lib" (that is if you are statically link MS files).

P.S.S. just noticed, that in plugins.cfg (which is in Demos/bin/$(Configuration)), the line says:
"PluginFolder=C:/Development/Ogre-Eihort/ogrenew/lib"
Should be "PluginFolder=."

P.S.S.S. just a little tiny thought - perhaps change default units to 1 unit = 1 meter? Makes it a bit easier to do an out-of-box test with physics used (they always do 1 unit = 1 meter).
That can be found in OgreALSound.cpp,
lines: 46-48 (change 3400 and 150 to something like 30 and 3);
same on lines: 68-70, 92-94.

OgreUser

28-10-2007 11:18:19

I tried your setup Aquatix.
I'll list step by step my actions when I want to build it :

- At the first build, it says OgreMain_d.lib is missing, because the folder set is $(OGRE_SDK)/lib/debug, tho the OgreSDK installation only creates $(OGRE_SDK)/lib.
So I modify it to $(OGRE_SDK)/lib where OgreMain_d.lib is.

- Rebuilding and getting the OgreAL::check(...) functions errors as usual.

- I saw you put your ogg and vorbis static libs in the setup, so I tried to use them instead of mines, but I get 43 errors, no surprises.

- I tried to rebuild ogg/vorbis libs, I get a lot of warnings from conversion signed/unsigned etc problem, but everything's building fine.

- Reinstalled OpenAL_SDK.

- Checked env paths, OGRE_HOME and OGREAL_SDK. I haven't OGRE_SRC as I'm using the SDK. Not using ALUT_BIN anymore as well.

So here I am, kinda desperate...

Aquatix

28-10-2007 16:06:01

Well, it really confuses me now.

- Rebuilding and getting the OgreAL::check(...) functions errors as usual.
There seems nothing wrong with this function really...

Try that - plecompiled OgreAL libs. I checked them on several machines, all work fine (provided you have OpenAL SDK or OpenAL redist)

http://rapidshare.com/files/65804421/ogreAL_libs_only.rar
If they don't work either... well, you gotta give it a try on a different machine.

CaseyB

28-10-2007 17:00:28

At the first build, it says OgreMain_d.lib is missing, because the folder set is $(OGRE_SDK)/lib/debug, tho the OgreSDK installation only creates $(OGRE_SDK)/lib.
So I modify it to $(OGRE_SDK)/lib where OgreMain_d.lib is.

Thanks! I fixed this in SVN now too. There is also a fix in there for the linker warning you mentioned. I am going to rethink the setup process as this seems to be the thing that most people have trouble with. I'll try to do like what Ogre does and have prebuilt dependencies for the various build systems.

OgreUser

28-10-2007 19:11:26

Hey there,

Good news at last, it's working.... OgreAL was built succesfully, and the basic demo as well. I'm shocked. :P


If you want some feedbacks on the setup process, here is where I got problems, (I'm a beginner.. so it's prolly not a problem for most of the people). That's maybe specific of my comp, or very minor things but here they are :

- You changed the lib path for OgreMain.lib, but you forgot a '(' during the correction:
$OGRE_HOM)/lib

- And you changed the path for the demos, but not for OgreAL project.

- There're still Alut settings: env path will give warning, and lib's required for OgreAL project if i recall correctly.

- OIS.lib's missing in the required dependencies for the demos.


And finally, what was the solution of my problem :
OgreALException.h and OgreALException.cpp were not added to OgreAL project as part of headers, and sources.

Anyway, everything's solved now, and I made huge improvement with using libs, includes, setting projects, path, etc.. :D

Huge thanks your for help and time Casey and Aquatix :)

OgreUser.

CaseyB

29-10-2007 00:38:45

I am so glad you got it working!! Part of the problem could be that the anonymous SVN from Sourceforge lags a little behind the Developer SVN, so it could have been a pit out of sync. Glad that it works now, sorry that there was so much trouble!

dermont

31-10-2007 17:29:12

Sorry for posting on a solved thread, but I think you may need to update your Linux build for the above files, i.e. add OgreALException.cpp to src/Makefile.am and OgreALException.h to
include/Makefile.am.

CaseyB

31-10-2007 19:25:17

That is absolutely true! Someone else helped me out with the autotools stuff, so I need to figure out how to do it.

dermont

31-10-2007 19:48:55


Index: include/Makefile.am
===================================================================
--- include/Makefile.am (revision 74)
+++ include/Makefile.am (working copy)
@@ -1 +1 @@
-pkginclude_HEADERS = OgreAL.h OgreALListener.h OgreALOggSound.h OgreALOggSoundStream.h OgreALPrereqs.h OgreALSound.h OgreALSoundManager.h OgreALSoundStream.h OgreALWavSound.h
+pkginclude_HEADERS = OgreAL.h OgreALListener.h OgreALOggSound.h OgreALOggSoundStream.h OgreALPrereqs.h OgreALSound.h OgreALSoundManager.h OgreALSoundStream.h OgreALWavSound.h OgreALException.h
Index: src/Makefile.am
===================================================================
--- src/Makefile.am (revision 74)
+++ src/Makefile.am (working copy)
@@ -1,4 +1,4 @@
INCLUDES = -I$(top_srcdir)/include -DOGRE_AL_EXPORT $(OGREAL_CFLAGS)
lib_LTLIBRARIES = libOgreAL.la
-libOgreAL_la_SOURCES = OgreALListener.cpp OgreALOggSound.cpp OgreALOggSoundStream.cpp OgreALSound.cpp OgreALSoundManager.cpp OgreALSoundStream.cpp OgreALWavSound.cpp
+libOgreAL_la_SOURCES = OgreALListener.cpp OgreALOggSound.cpp OgreALOggSoundStream.cpp OgreALSound.cpp OgreALSoundManager.cpp OgreALSoundStream.cpp OgreALWavSound.cpp OgreALException.cpp
libOgreAL_la_LIBADD = $(OGREAL_LIBS)

CaseyB

31-10-2007 20:18:41

You ROCK!! Thank you! I am out of town right now, but I'll apply that patch as soon as I get back tomorrow night!

I really should learn to use Autotools though!

CaseyB

02-11-2007 03:14:19

Ok, this patch is in!! Thank you!!