Pretty stupid question but.....

derutydragon

07-02-2007 03:44:44

I'm a bit embarrassed to say, but I'm slightly confused/challenged when it comes to learning to link libraries. I "thought" I knew what was going on when I installed the OGRE SDK, but I guess not, Since at the moment I'm evidently missing some kind of link somewhere.

"undefined reference to 'oggpack_reset'"

and a bunch of over 'oggpack_<something>' stufff

I'm using Codeblocks (nightly builds)

I've set everything up correctly (I think) except for the compiling of the vorbis library (in which this error occurred).


Soooo if somebody could tell me whats missing I'd be most appreciative.

P.S. I'm going to continue to try and figure this out myself, but its taking me longer than I thought and I seem to still miss the same thing over and over....

t0tAl_mElTd0wN

07-02-2007 04:19:47

Just solved a similar problem like that. Looks like it's relating to the ogg library? Try re-arranging the order in which your libraries are included. The ogg/vorbis libraries use 'extern', which requires the function in question be linked *before* it's needed. Try linking the ogg libraries first.

CaseyB

07-02-2007 04:36:18

I assume you set up the ogg / vorbis directories at the same level as the OgreAL directory like in the setup post at the top of this forum? If so then tryt0tAl_mElTd0wN's suggestion and see if that works.

derutydragon

07-02-2007 12:51:23

Yeah that was my problem....I sorta forgot to link the libraries XD

Uhm yeah but am I supposed to be getting warnings such as:

'mag_memo' might be used uninitialized
'mag_sort' might be used uninitialized
'A' might be used uninitialized
'B' might be used uninitialized
'D' might be used uninitialized

CaseyB

07-02-2007 13:50:32

Are you getting those warnings from OgreAL, or the Ogg / Vorbis stuff?

derutydragon

07-02-2007 17:28:50

Just the vorbis stuff. Its okay right?

t0tAl_mElTd0wN

07-02-2007 18:55:56

I haven't had any problems with those sorts of warnings. For stuff I didn't write myself, I pretty much just ignore them.

derutydragon

07-02-2007 18:59:10

I'm also getting this error also when I'm compiling OgreAL....

"Execution of 'cl.exe /nologo /EHs /Ot /DOGRE_AL_EXPORT /I\OgreMain\include /IC:\OgreSDK\include /I"C:\Program Files\OpenAL 1.1 SDK\include" /IC:\freealut\include /I..\include /I..\..\ogg\include /I..\..\vorbis\include /I"C:\Program Files\Microsoft Visual Studio 8\VC\include" /c ..\src\OgreALOggSound.cpp /FoDebug\src\OgreALOggSound.obj' in 'C:\OgreALv0.2\OgreAL\OgreAL' failed."

I think this might be Codeblocks related, I looked it up and it might have to do with the Visual Studio and Codeblocks. I've never seen this before and I have no clue what to do....

CaseyB

07-02-2007 19:13:41

What does your directory structure look like? From what I can see it looks likeC:\
|-OgreALv0.2
|-OgreAL
| |-OgreAL
|-ogg
|-vorbis
Is that right?

t0tAl_mElTd0wN

07-02-2007 19:34:40

It almost looks like it can't find the compiler executable. Perhaps check and make sure the paths are correct?

derutydragon

07-02-2007 22:07:58

Is ogg and vorbis supposed to be next to the 2nd OgreAL inside the 1st OgreAL? I thought the setup instructions wanted it next to the 1st OgreAL.

Uhm I don't know about the compiler thing. I don't have Visual Studio installed so I can't fix this one "C:\Program Files\Microsoft Visual Studio 8\VC\include"

Which compiler does OgreAL compile best under? I normally use the GNU GCC Compiler and that one works fine, except now.....

t0tAl_mElTd0wN

07-02-2007 23:44:59

As far as I know, Visual Studio is your best bet. Codeblocks support is minimal (that's one of my tasks)

the ogg and vorbis directories are expected to be just outside the OgreAL directory. If you were to "Extract Here" from the zip file, you should extract into the same folde that contains /ogg and /vorbis. That being one level above where the project files are.


Projects
|- OgreAL
| |- OgreAL.sln
| |- OgreAL.workspace
| |- etc...
|- vorbis
|- ogg


As for the compiler error, See if you can find that program - cl.exe. You should be able to change where codeblocks looks for that in Settings -> Compiler and Debugger, and then I believe it's called 'Toolchain executables' or something like that. Just select which compiler to use, and then the locations of each of the tools.

Let us know how you make out! :)

CaseyB

08-02-2007 01:00:31

Yup, the structure that t0tAl_mElTd0wN shows is exactly correct!

derutydragon

08-02-2007 01:20:01

Fixed the compiler thing. Now I have an OgreMain_d.lib opening error. I think I know how to fix that one though :D.

CaseyB

08-02-2007 02:42:41

Is that when it's trying to link the demos? If so, then it could be that the lib file is not where they are looking for it. I have very little experience with Code::Blocks so this very well could be an error on my part!

derutydragon

08-02-2007 03:32:41

I just started to try and compile a demo instead and guess what....

:: === Basic_Demo, Debug ===
main.cpp:4: fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
:: === Build finished: 1 errors, 0 warnings ===

Thats right it couldn't find windows.h ><

So is this something I should know how to fix, because I thought initially I had messed up the directories since I was linking to files left and right when it first wasn't working. I reloaded and redid everything and I still got this.
So if theres a simple fix and its just because I rushed through all the tutorials and end up reading them 3 times then please tell me :D

But yeah I also get this error:

:: === OgreAL, Debug ===
LINK:: fatal error LNK1181: cannot open input file 'OgreMain_d.lib'
:: === Build finished: 1 errors, 0 warnings ===

When Compiling OgreAL. The .cbp that was in the OgreAL (second folder).

t0tAl_mElTd0wN

08-02-2007 04:22:34

Make sure OGRE_SRC and OGRE_HOME are both set to the Ogre directory (usually 'ogrenew', in my case C:\Ogre\ogrenew)

CaseyB

08-02-2007 04:26:46

If you are using the Ogre SDK, then the installer will have already set OGRE_HOME for you so you won't need to mess with that, if you are buidling from source, then yup, OGRE_SRC needs to point to the ogrenew folder, but you still don't need to worry about OGRE_HOME, the only reason they are both there is so that people who use the SDK and people who build from source can use the same project files.

derutydragon

08-02-2007 17:03:14

Thats the thing.. I have OGRE_HOME set and yet OgreAL gets an error about opening OgreMain_d.lib.....

Same thing with windows.h.....

kungfoomasta

08-02-2007 18:48:03

If it can't find Windows.h, I would think the platform SDK is not installed. Are you using Visual C++ 2005 Express?

http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/

If you have problems linking to libs, right click on the project, go to properties, linker sub group, and look where your include paths are set. If this path does not match the actual path to your libs then you will get errors.

KungFooMasta

derutydragon

08-02-2007 22:57:49

Okay I think I fixed the OgreMain_d.lib thing....I think...

I'm getting a new error:

LINK:: fatal error LNK1181: cannot open input file 'vorbis_static_d.lib'
:: === Build finished: 1 errors, 0 warnings ===

Now when I compiled the vorbis static library the files saved as "libvorbis_static_d.a" So..... I thought I changed the name of the linker but instead I get

LINK:: fatal error LNK1181: cannot open input file 'libvorbis_static_d.a.lib'
:: === Build finished: 1 errors, 0 warnings ===


I'm probably just being a really big nuisance now :/

CaseyB

08-02-2007 23:12:36

So you're using the GCC compiler? You'll need to go through the OgreAL project files and replace the .lib extensions, with .a. Then it would be libvorbis_static_d.a, it seems that you have libvorbis_static_d.lib.a

derutydragon

09-02-2007 00:20:43

Uhm.... how do I do that?

<-- has never done that before -.-

Also turns out the OgreMain_d.lib I used was from a different application. I followed the directories and I found a dll with the same name instead. So..... If somebody could explain exactly how to do that I would really be appreciative.

t0tAl_mElTd0wN

09-02-2007 00:29:30

With the GNU compiler toolchain (gcc), a linker will automatically add lib at the beginning, and .a at the end of whatever you specify.

So if I have libOgreMain.a, I specify the library to link with as 'OgreMain'

I believe, on Windows, it works similarly, except with .lib files. You have OgreMain.lib, by specifying 'OgreMain', it'll look for OgreMain.lib (or OgreMain_d for Ogremain_d.lib)

It's part of the naming conventions that have made Linux development such a joy (having done both, I wouldn't develop on Windows if I had a choice ;) )

derutydragon

09-02-2007 03:19:42

Man I am sooo un-observant -.- My compiler switched on me and changed over to a Visual Studio 2005 one. I've switched it back to GCC and OgreAL compiles fine, just with 49 warnings and 1 error -.-
I'm not going to post all the warnings since theres 49 and most of them are about the same so heres just the one error and a few of the warnings.

C:\Program Files\OpenAL 1.1 SDK\include\xram.h:94: warning: no newline at end of file
..\src\OgreALSound.cpp:6: warning: function 'OgreAL::Sound::Sound()' is
..\src\OgreALSound.cpp:322: warning: function 'virtual void OgreAL::Sound::_updateRenderQueue(Ogre::RenderQueue*)' is defined after prior declaration as dllimport: attribute ignored
..\src\OgreALSound.cpp:327: warning: function 'virtual void OgreAL::Sound::_notifyAttached(Ogre::Node*, bool)' is defined after prior declaration as dllimport: attribute ignored
..\src\OgreALSound.cpp:338: error: definition of static data member 'OgreAL::SoundFactory::FACTORY_TYPE_NAME' of dllimport'd class.
..\src\OgreALSound.cpp:338: warning: 'OgreAL::SoundFactory::FACTORY_TYPE_NAME' defined locally after being referenced with dllimport linkage
:: === Build finished: 1 errors, 49 warnings ===

CaseyB

09-02-2007 05:02:38

..\src\OgreALSound.cpp:338: error: definition of static data member 'OgreAL::SoundFactory::FACTORY_TYPE_NAME' of dllimport'd class.If you are building OgreAL, then it should be dllexport, not dllimport. Do you have OGRE_AL_EXPORT in your preprocessor definitions?

Wait, I didn't think that the GCC compiler did dllimport / dllexport? This is what I have in OgreALPrereqs.h#if OGRE_COMPILER == OGRE_COMPILER_MSVC
# include "al.h"
# include "alc.h"
# include "AL/alut.h"
# include "xram.h"
# ifdef OGRE_AL_EXPORT
# define OgreAL_Export __declspec(dllexport)
# else
# define OgreAL_Export __declspec(dllimport)
# endif
#elif OGRE_COMPILER == OGRE_COMPILER_GNUC
# include "AL/al.h"
# include "AL/alc.h"
# include "AL/alut.h"
# if defined(OGRE_AL_EXPORT) && OGRE_COMP_VER >= 400
# define OgreAL_Export __attribute__ ((visibility("default")))
# else
# define OgreAL_Export
# endif
// fake EAX/X-RAM
typedef ALenum (*EAXGetBufferMode)(ALuint buffer, ALint *pReserved);
typedef ALboolean (*EAXSetBufferMode)(ALsizei n, ALuint *buffers, ALint value);
#else // Other Compilers
# include "al.h"
# include "alc.h"
# include "alut.h"
# include "xram.h"
# define OgreAL_Export
#endif
Might I need something else for GCC under Windows?

derutydragon

09-02-2007 12:53:16

Well I don't know ...

Theres a "/DOGRE_AL_EXPORT" in the preprocessor (I think).

Also my header file is a bit different.

#ifndef _OGRE_AL_PREREQS_H_
#define _OGRE_AL_PREREQS_H_

#include "Ogre.h"

namespace OgreAL{
/* #if OGRE_COMPILER == OGRE_COMPILER_MSVC
# pragma warning (disable : 4800) // Disable warning forcing ALboolean to 'true' or 'false'
*/
# include "al.h"
# include "alc.h"
# include "AL/alut.h"
# include "xram.h"
# ifdef OGRE_AL_EXPORT
# define OgreAL_Export __declspec(dllexport)
# else
# define OgreAL_Export __declspec(dllimport)
# endif
/* #elif OGRE_COMPILER == [b]OGRE_COMPILER_GNUC[/b]
# include "AL/al.h"
# include "AL/alc.h"
# include "AL/alut.h"
# if defined(OGRE_AL_EXPORT) && OGRE_COMP_VER >= 400
# define OgreAL_Export __attribute__ ((visibility("default")))
# else
# define OgreAL_Export
# endif
// fake EAX/X-RAM
typedef ALenum (*EAXGetBufferMode)(ALuint buffer, ALint *pReserved);
typedef ALboolean (*EAXSetBufferMode)(ALsizei n, ALuint *buffers, ALint value);
#else // Other Compilers
# include "al.h"
# include "alc.h"
# include "alut.h"
# include "xram.h"
# define OgreAL_Export
#endif
*/
typedef ALenum BufferType;
typedef ALenum State;
typedef ALuint SourceRef;
typedef ALuint BufferRef;
typedef ALuint EAXMode;
typedef ALsizei Size;
typedef ALchar* ALString;
}
#endif



I'm not sure but if this is for better or worse. I un-comment out everything, now I get:

-------------- Build: Debug in OgreAL ---------------
Compiling: ..\src\OgreALOggSound.cpp
mingw32-g++.exe: /EHs: No such file or directory
mingw32-g++.exe: /Ot: No such file or directory
mingw32-g++.exe: /DOGRE_AL_EXPORT: No such file or directory
Process terminated with status 1 (0 minutes, 11 seconds)
0 errors, 0 warnings

Not an error but not good either :D I'm going to look into this a bit more but right now I don't have time.

t0tAl_mElTd0wN

09-02-2007 13:46:03

Ah. It looks like your parameters are in the wrong format. the 'slash' format is a Windows standard. I believe in Windows the syntax is -DVARIABLENAME, so in your case -DOGRE_AL_EXPORT.

Either way, Codeblocks actually provides a nice mechanism for #defines. It's somewhere in the compiler settings - I forget where. You can set a bunch of variables for the preprocessor to define, and the format of the parameters is handled entirely by codeblocks.

derutydragon

09-02-2007 18:27:10

-------------- Build: Debug in OgreAL ---------------
Compiling: ..\src\OgreALOggSoundStream.cpp
cc1plus.exe: error: invalid option argument `-Ot'
mingw32-g++.exe: unrecognized option `-EHs'
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings

-Ot and -EHs what is that? They had the /'s and I changed them over to -'s but it doesn't seem to work. The heck are Ot and EHs ><!!

t0tAl_mElTd0wN

09-02-2007 18:50:25

Looks like they aren't anything to GCC. I'd go ahead and remove them.

[edit] I looked at GCC on my shell server, and there are indeed no -O or -E options.

derutydragon

10-02-2007 13:55:00

Well damn... I think I've caught up to Apache and we're having the same errors now....

See?

:: === OgreAL, Debug ===
..\src\OgreALSoundManager.cpp:369: warning: NULL used in arithmetic
..\src\OgreALWavSound.cpp:11: warning: `alutLoadWAVFile' is deprecated (declared at C:/freealut/include/AL/alut.h:113)
..\src\OgreALWavSound.cpp:11: warning: `alutLoadWAVFile' is deprecated (declared at C:/freealut/include/AL/alut.h:113)
..\src\OgreALWavSound.cpp:15: warning: `alutUnloadWAV' is deprecated (declared at C:/freealut/include/AL/alut.h:116)
..\src\OgreALWavSound.cpp:15: warning: `alutUnloadWAV' is deprecated (declared at C:/freealut/include/AL/alut.h:116)
OgreALOggSound.cpp:: undefined reference to `Ogre::Exception::Exception(int, std::string const&, std::string const&)'
OgreALOggSound.cpp:: undefined reference to `Ogre::Exception::Exception(int, std::string const&, std::string const&)'
OgreALOggSound.cpp:: undefined reference to `Ogre::Exception::Exception(int, std::string const&, std::string const&)'
OgreALOggSound.cpp:: undefined reference to `Ogre::Exception::Exception(int, std::string const&, std::string const&)'
:OgreALOggSound.cpp:: undefined reference to `Ogre::ShadowCaster::generateShadowVolume(Ogre::EdgeData*, Ogre::HardwareIndexBufferSharedPtr, Ogre::Light const*, std::vector<Ogre::ShadowRenderable*, std::allocator<Ogre::ShadowRenderable*> >&, unsigned long)'
:OgreALOggSound.cpp:: undefined reference to `Ogre::Exception::Exception(int, std::string const&, std::string const&, char*, long)'
:OgreALOggSound.cpp:: undefined reference to `Ogre::Exception::Exception(int, std::string const&, std::string const&, char*, long)'
OgreALOggSoundStream.cpp:: undefined reference to `Ogre::Exception::Exception(int, std::string const&, std::string const&)'
OgreALOggSoundStream.cpp:: undefined reference to `Ogre::Exception::Exception(int, std::string const&, std::string const&)'
OgreALOggSoundStream.cpp:: undefined reference to `Ogre::Exception::Exception(int, std::string const&, std::string const&)'
OgreALOggSoundStream.cpp:: undefined reference to `Ogre::Exception::Exception(int, std::string const&, std::string const&)'
OgreALOggSoundStream.cpp:: undefined reference to `Ogre::Exception::Exception(int, std::string const&, std::string const&)'
OgreALOggSoundStream.cpp:: more undefined references to `Ogre::Exception::Exception(int, std::string const&, std::string const&)' follow
:OgreALOggSoundStream.cpp:: undefined reference to `Ogre::ShadowCaster::generateShadowVolume(Ogre::EdgeData*, Ogre::HardwareIndexBufferSharedPtr, Ogre::Light const*, std::vector<Ogre::ShadowRenderable*, std::allocator<Ogre::ShadowRenderable*> >&, unsigned long)'
OgreALSound.cpp:: undefined reference to `Ogre::MovableObject::MovableObject(std::string const&)'
OgreALSound.cpp:: undefined reference to `Ogre::MovableObject::MovableObject(std::string const&)'
OgreALSound.cpp:: undefined reference to `Ogre::Exception::Exception(int, std::string const&, std::string const&)'
OgreALSound.cpp:: undefined reference to `Ogre::StringConverter::parseBool(std::string const&)'
OgreALSound.cpp:: undefined reference to `Ogre::StringConverter::parseBool(std::string const&)'
OgreALSound.cpp:: undefined reference to `Ogre::Exception::Exception(int, std::string const&, std::string const&)'
OgreALSound.cpp:: undefined reference to `Ogre::StringConverter::parseBool(std::string const&)'
OgreALSound.cpp:: undefined reference to `Ogre::Exception::Exception(int, std::string const&, std::string const&)'
OgreALSound.cpp:: undefined reference to `Ogre::Exception::Exception(int, std::string const&, std::string const&)'
OgreALSound.cpp:: undefined reference to `Ogre::Exception::Exception(int, std::string const&, std::string const&)'
:OgreALSound.cpp:: undefined reference to `Ogre::MovableObjectFactory::createInstance(std::string const&, Ogre::SceneManager*, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const*)'
:OgreALSound.cpp:: undefined reference to `Ogre::ShadowCaster::generateShadowVolume(Ogre::EdgeData*, Ogre::HardwareIndexBufferSharedPtr, Ogre::Light const*, std::vector<Ogre::ShadowRenderable*, std::allocator<Ogre::ShadowRenderable*> >&, unsigned long)'
OgreALSoundManager.cpp:: undefined reference to `Ogre::LogManager::logMessage(std::string const&, Ogre::LogMessageLevel, bool)'
OgreALSoundManager.cpp:: undefined reference to `Ogre::LogManager::logMessage(std::string const&, Ogre::LogMessageLevel, bool)'
OgreALSoundManager.cpp:: undefined reference to `Ogre::LogManager::logMessage(std::string const&, Ogre::LogMessageLevel, bool)'
OgreALSoundManager.cpp:: undefined reference to `Ogre::Exception::Exception(int, std::string const&, std::string const&)'
OgreALSoundManager.cpp:: undefined reference to `Ogre::Exception::Exception(int, std::string const&, std::string const&)'
OgreALSoundManager.cpp:: undefined reference to `Ogre::LogManager::logMessage(std::string const&, Ogre::LogMessageLevel, bool)'
OgreALSoundManager.cpp:: undefined reference to `Ogre::LogManager::logMessage(std::string const&, Ogre::LogMessageLevel, bool)'
OgreALSoundManager.cpp:: undefined reference to `Ogre::LogManager::logMessage(std::string const&, Ogre::LogMessageLevel, bool)'
OgreALSoundManager.cpp:: undefined reference to `Ogre::StringConverter::toString(int, unsigned short, char, std::_Ios_Fmtflags)'
OgreALSoundManager.cpp:: undefined reference to `Ogre::StringConverter::toString(int, unsigned short, char, std::_Ios_Fmtflags)'
OgreALSoundManager.cpp:: undefined reference to `Ogre::LogManager::logMessage(std::string const&, Ogre::LogMessageLevel, bool)'
OgreALSoundManager.cpp:: undefined reference to `Ogre::LogManager::logMessage(std::string const&, Ogre::LogMessageLevel, bool)'
OgreALSoundManager.cpp:: undefined reference to `Ogre::StringConverter::toString(int, unsigned short, char, std::_Ios_Fmtflags)'
OgreALSoundManager.cpp:: undefined reference to `Ogre::StringConverter::toString(int, unsigned short, char, std::_Ios_Fmtflags)'
OgreALSoundManager.cpp:: undefined reference to `Ogre::LogManager::logMessage(std::string const&, Ogre::LogMessageLevel, bool)'
OgreALSoundManager.cpp:: undefined reference to `Ogre::LogManager::logMessage(std::string const&, Ogre::LogMessageLevel, bool)'
OgreALSoundManager.cpp:: undefined reference to `Ogre::LogManager::logMessage(std::string const&, Ogre::LogMessageLevel, bool)'
OgreALSoundManager.cpp:: undefined reference to `Ogre::LogManager::logMessage(std::string const&, Ogre::LogMessageLevel, bool)'
OgreALSoundManager.cpp:: undefined reference to `Ogre::Exception::Exception(int, std::string const&, std::string const&)'
OgreALSoundManager.cpp:: undefined reference to `Ogre::Exception::Exception(int, std::string const&, std::string const&)'
OgreALSoundManager.cpp:: undefined reference to `Ogre::LogManager::logMessage(std::string const&, Ogre::LogMessageLevel, bool)'
OgreALSoundManager.cpp:: undefined reference to `Ogre::LogManager::logMessage(std::string const&, Ogre::LogMessageLevel, bool)'
OgreALSoundManager.cpp:: undefined reference to `Ogre::LogManager::logMessage(std::string const&, Ogre::LogMessageLevel, bool)'
OgreALSoundManager.cpp:: undefined reference to `Ogre::StringConverter::toString(int, unsigned short, char, std::_Ios_Fmtflags)'
:: More errors follow but not being shown.
:: Edit the max errors limit in compiler options...
:: === Build finished: 50 errors, 5 warnings ===

Also these don't look very good either :/

Compiling: ..\src\OgreALListener.cpp
Linking dynamic library: ..\lib\Debug\OgreAL_d.dll
Cannot export .idata$4: symbol not found
Cannot export .idata$5: symbol not found
Cannot export .idata$6: symbol not found
Cannot export .text: symbol not found
Cannot export OpenAL32_NULL_THUNK_DATA: symbol not found
Creating library file: ..\lib\Debug\libOgreAL_d.a

I only get the 50 build errors after it tries creating library file.

derutydragon

10-02-2007 14:01:02

And before you ask. Yes I did remember to link OgreMain_d

CaseyB

10-02-2007 15:31:27

And before you ask. Yes I did remember to link OgreMain_dWas it the right version of OgreMain_d? I mean if you are using the GCC compiler did you build Ogre with it too? Are you sure that you aren't linking against and old version that hasn't been updated? I had errors like these once and it turns out that I had multiple versions of the Ogre libs and I had set the linker path to point at the wrong one.

derutydragon

10-02-2007 16:49:46

Well how old would a version have to be before it wouldn't work? I have 1.2 I think....

And yes I did compile everything in Ogre with a GCC Compiler.

CaseyB

10-02-2007 18:40:49

Sorry, I didn't mean an old release of Ogre, I meant an old version of the lib that you built with something else. I assume it's hitting these error while linking, right?

derutydragon

10-02-2007 18:58:46

Yes