Compiling OgreAL with Code::Blocks and GNU GCC Compiler

Apache81

08-02-2007 09:05:53

Hi to everyone !!!
I'm a very newcomer in OgreAL but I hope I can use it for long time as Ogre itself.
I'm developing a little project with Ogre using Code::Blocks and GNU GCC Compiler and it was all right untill I start to use OgreAL. In fact I was able to compile OgreAL dlls with Visual Studio 2005, but if I use it with others Ogre dlls or executables compiled with GNU GCC I'm not able to find the entry points of exported functions from the dll compiled with Visual Studio 2005.
I don't know if I messed up with something, so if is a problem of mine, but for sure it's official that I'm not able to compile OgreAL with GNU GCC compiler. I thought that was because of the older versions of Ogre SDK and Code::Blocks that I used, so I updated all of them and all seems to be ok, but if I try to compile OgreAL, it doesn't go. When I compile OgreAL somethimes Code::Blocks seems to compile it but it produces no binary and somethimes it gives me the following error:

OgreALSound.cpp:338: error: definition of static data member
'OgreAL::SoundFactory::FACTORY_TYPE_NAME' of dllimport'd class

Can anyone tell me what's going on? I have to say that I'm using the Code::Blocks script given with OgreAL code but I have switched the Visual Studio 2005 compiler with GNU GCC one.

Thank you for your precious help !!!

CaseyB

08-02-2007 13:59:55

I added in the Code::Blocks project files with the last release and only tested them with the Visual Studio compilers. However t0tAl_mElTd0wN has recently joined the OgreAL team and is a Code::Blocks /. GNU Compiler user and is working to get it building in that environment! Sorry about the delay and plaese bear with us while we get this sorted. Or if you find a way to get it working, let us know and we can make the changes! ;)

t0tAl_mElTd0wN

08-02-2007 14:43:28

Yeah, I haven't been having much luck as far as Codeblocks goes. I'll continue working on it, but I've been trying to set up an Ogre development environment of my own the past few weeks, and I've seen enough linker errors to last me a lifetime and a half, so it'll likely be a while before I get to it.

I think you might be able to link your build in Visual Studio with your project in Codeblocks. Perhaps give that a try?

Apache81

09-02-2007 17:34:59

Well... I tried to link my Code::Blocks project with Visual Studio compiled dll of OgreAL but it doesn't seems to work: the linker says to me that it cannot find reference to function that OgreAL functions that I use in my app.

However, I'm tring to create a Code::Blocks script from my own to compile the OgreAL source I downloaded and, after no less difficulties, now I'm getting these messages from linker:

-------------- Build: Debug in OgreAL ---------------
Linking dynamic library: .\OgreAL_d.dll
Warning: .drectve `/DEFAULTLIB:"LIBCMTD" /DEFAULTLIB:"OLDNAMES" /EDITANDCONTINUE ' unrecognized
Warning: .drectve `/DEFAULTLIB:"LIBCMTD" /DEFAULTLIB:"OLDNAMES" /EDITANDCONTINUE ' unrecognized
.\obj\Debug\OgreALOggSound.o: In function `ZN6OgreAL8OggSoundC2ESsSsb':
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:7: undefined reference to `_imp___ZN6OgreAL5SoundC2ERKSs'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:7: undefined reference to `_imp___ZTVN6OgreAL8OggSoundE'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:7: undefined reference to `_imp___ZTVN6OgreAL8OggSoundE'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:27: undefined reference to `_imp___ZN6OgreAL12SoundManager12getSingletonEv'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:28: undefined reference to `_imp___ZN6OgreAL12SoundManager12getSingletonEv'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:38: undefined reference to `_imp___ZN6OgreAL5Sound10checkErrorESs'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:40: undefined reference to `_imp___ZN6OgreAL12SoundManager12getSingletonEv'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:42: undefined reference to `_imp___ZN6OgreAL12SoundManager12getSingletonEv'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:42: undefined reference to `_imp___ZN6OgreAL12SoundManager12xRamHardwareE'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:42: undefined reference to `_imp___ZN6OgreAL12SoundManager16eaxSetBufferModeEiPjj'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:56: undefined reference to `_imp___ZN6OgreAL5Sound10initSourceEv'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:56: undefined reference to `_imp___ZN6OgreAL5SoundD2Ev'
.\obj\Debug\OgreALOggSound.o: In function `ZN6OgreAL8OggSoundC1ESsSsb':
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:7: undefined reference to `_imp___ZN6OgreAL5SoundC2ERKSs'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:7: undefined reference to `_imp___ZTVN6OgreAL8OggSoundE'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:7: undefined reference to `_imp___ZTVN6OgreAL8OggSoundE'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:27: undefined reference to `_imp___ZN6OgreAL12SoundManager12getSingletonEv'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:28: undefined reference to `_imp___ZN6OgreAL12SoundManager12getSingletonEv'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:38: undefined reference to `_imp___ZN6OgreAL5Sound10checkErrorESs'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:40: undefined reference to `_imp___ZN6OgreAL12SoundManager12getSingletonEv'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:42: undefined reference to `_imp___ZN6OgreAL12SoundManager12getSingletonEv'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:42: undefined reference to `_imp___ZN6OgreAL12SoundManager12xRamHardwareE'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:42: undefined reference to `_imp___ZN6OgreAL12SoundManager16eaxSetBufferModeEiPjj'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:56: undefined reference to `_imp___ZN6OgreAL5Sound10initSourceEv'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:56: undefined reference to `_imp___ZN6OgreAL5SoundD2Ev'
.\obj\Debug\OgreALOggSound.o: In function `ZN6OgreAL8OggSoundD2Ev':
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:60: undefined reference to `_imp___ZTVN6OgreAL8OggSoundE'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:60: undefined reference to `_imp___ZTVN6OgreAL8OggSoundE'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:64: undefined reference to `_imp___ZN6OgreAL5Sound10checkErrorESs'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:67: undefined reference to `_imp___ZN6OgreAL5SoundD2Ev'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:67: undefined reference to `_imp___ZN6OgreAL5SoundD2Ev'
.\obj\Debug\OgreALOggSound.o: In function `ZN6OgreAL8OggSoundD1Ev':
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:60: undefined reference to `_imp___ZTVN6OgreAL8OggSoundE'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:60: undefined reference to `_imp___ZTVN6OgreAL8OggSoundE'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:64: undefined reference to `_imp___ZN6OgreAL5Sound10checkErrorESs'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:67: undefined reference to `_imp___ZN6OgreAL5SoundD2Ev'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:67: undefined reference to `_imp___ZN6OgreAL5SoundD2Ev'
.\obj\Debug\OgreALOggSound.o: In function `ZN6OgreAL8OggSoundD0Ev':
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:60: undefined reference to `_imp___ZTVN6OgreAL8OggSoundE'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:60: undefined reference to `_imp___ZTVN6OgreAL8OggSoundE'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:64: undefined reference to `_imp___ZN6OgreAL5Sound10checkErrorESs'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:67: undefined reference to `_imp___ZN6OgreAL5SoundD2Ev'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSound.cpp:67: undefined reference to `_imp___ZN6OgreAL5SoundD2Ev'
.\obj\Debug\OgreALOggSoundStream.o: In function `ZN6OgreAL14OggSoundStreamC2ESsSsb':
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSoundStream.cpp:7: undefined reference to `_imp___ZN6OgreAL11SoundStreamC2ERKSs'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSoundStream.cpp:7: undefined reference to `_imp___ZTVN6OgreAL14OggSoundStreamE'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSoundStream.cpp:7: undefined reference to `_imp___ZTVN6OgreAL14OggSoundStreamE'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSoundStream.cpp:22: undefined reference to `_imp___ZN6OgreAL12SoundManager12getSingletonEv'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSoundStream.cpp:23: undefined reference to `_imp___ZN6OgreAL12SoundManager12getSingletonEv'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSoundStream.cpp:33: undefined reference to `_imp___ZN6OgreAL5Sound10checkErrorESs'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSoundStream.cpp:35: undefined reference to `_imp___ZN6OgreAL12SoundManager12getSingletonEv'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSoundStream.cpp:37: undefined reference to `_imp___ZN6OgreAL12SoundManager12getSingletonEv'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSoundStream.cpp:37: undefined reference to `_imp___ZN6OgreAL12SoundManager14xRamAccessibleE'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSoundStream.cpp:37: undefined reference to `_imp___ZN6OgreAL12SoundManager16eaxSetBufferModeEiPjj'
C:/Programmi/OGRE/OgreAL/Apache Script/OgreAL/OgreALOggSoundStream.cpp:42: undefined reference to `_imp___ZN6OgreAL14OggSoundStream6streamEj'
Process terminated with status 1 (0 minutes, 35 seconds)
50 errors, 2 warnings

Yep... those're a lot !!! I cannot understand why it tells me that cannot find reference for function that I have in headers and sources I'm trying to compile. I did also some web searches to understand and I found that it could be a gcc passed parameters error. What do you think about it?

I must confess that I'm very courious to know what are the linking problems you found: adre the same of mine?
Hope I can help !!!

Apache81

09-02-2007 17:43:20

Sorry, but I was wondering: could it be a problem of ogg and vorbis compiled with Visual Studio? I mean: if ogg and vorbis libraries were compiled with GCC, will these errors occurs? But it seems strange that I cannot use Visual Studio compiled libraries with GCC compiled programms. What do you think about it?

CaseyB

09-02-2007 19:24:14

But it seems strange that I cannot use Visual Studio compiled libraries with GCC compiled programms.It shouldn't seem strange, that's the way it is. You can't mix libraries and programs that have been made with different compilers. Look at Ogre, the have several different dependencies packages because they are each compiled with different compilers. So you'll need to build ogg, vorbis, Ogre, OgreAL and your app with the GCC compiler in order for it to work.

Apache81

09-02-2007 19:58:39

Yes, but it is very difficult to compile a program made by someone else if you don't have a well set script and a similar environment. I don't think I can compile ogg and vorbis libraries without having a GNU GCC environment set by the authors of source code. I think that's so also for Ogre, OpenAL and ALUT. I prefer not to use Visual Studio... but I don't know how to do. I guess if for OgreODE will be the same thing !!! Anyway, I'll try to compile all with Code::Blocks/MingW and if I'll do it I'll post here something.

Thanks for your support guys !!!

t0tAl_mElTd0wN

09-02-2007 20:42:37

I actually said the exact same thing, but a week of linker errors later, I gave in. The last time I used Visual Studio was version 6, and I was... well, it sucks. I have VS.NET 2003 through work, though, and I have to say it's a hell of a lot better than previous versions. I might even go so far as to say it's good, and I like it.

Except I don't like how insanely Microsoft-specific all the project templates are. That upsets me.

Apache81

09-02-2007 20:50:16

So I can suggest you to try Visual Studio .NET 2005... more project oriented and well projected GUI to make easiest the known of your programming environment. I found it very interesting, but the damned dependencies are still too tentaclers !!!
Dunno, but give it a try... maybe for you will be ok.
To tell you the truth I also found it very interesting and well done (to be a Microsoft programm :twisted: ), but I still prefer open source and free programm: if you have problems with Microsoft compiler you risk to not resolve it untill the next platform upgrade, or worst, untill the next service pack release :cry: