Sign in to follow this  
BigDogUK

Can someone walk me through setting up OpenAL?

Recommended Posts

BigDogUK    122
Hey all. Pretty new to coding and I've been playing around on my Mac and managed to write Pong and currently working on Asteroids using OpenGL and OpenAL. Now, on the Mac it was all darn simple: add framework, code, compile! But I'm a bit bewildered with Windows. I've managed to get OpenGL working by following a tutorial but there's nothing on OpenAL. So can someone walk me through how I get some OpenAL code to compile on Windows? Linking and all that confuses me :P I'm happy to use whatever program etc. (I'm using Dev C++ to compile under OpenGL) Thanks

Share this post


Link to post
Share on other sites
BorisTSR    165
http://www.gamedev.net/reference/articles/article1958.asp

no offence, but if you need more help than that, then i seriously suggest you learn the linking process and other basics like that. in the long run everything will be MUCH easier in the future. if you intend to just brush past it or skip it completely then your going to make life much harder on you.

there is plenty of tutorials and documents on linking around. what your looking for specifically is how to use "mingw"'s linker, and mingw is based of "gcc" so all documents and tutorials on gcc are also quite relevant.

**edit**
i don't mean to sound rude. but it'll be much more beneficial for you to learn how to use the linker properly, not just c/p from guides, trust me i know, i used to do that, and it made life very difficult not knowing about the linker, constant build errors, huge trouble using a new library, etc.

Share this post


Link to post
Share on other sites
BigDogUK    122
I'll have a look and learn about linkers then (Damn Windows :P )

I'd already looked at the OpenAL GameDev link you posted, it helped me to learn how to code using OpenAL but it doesn't explain how to compile and where to put the files.

Share this post


Link to post
Share on other sites
BigDogUK    122
Hmm, having trouble finding any useful info. Anyone know of any good guides for learning about linkers?

Or know what I should stick in my linker options under Project Options in Dev C++.

I've put the OpenAL files in the corresponding folders (Lib and Include) like I did with GLUT and I can run a program that uses OpenAL so I've got the DLL in the right place too.

For GLUT/OpenGL I've got: -lopengl32 -lglu32 -lglut32

In the linker box. What is this actually telling it to do? And what will I need to use to link OpenAL?

Thanks

Share this post


Link to post
Share on other sites
TheOther    150
Quote:
Original post by BigDogUK
Hmm, having trouble finding any useful info. Anyone know of any good guides for learning about linkers?

Or know what I should stick in my linker options under Project Options in Dev C++.

I've put the OpenAL files in the corresponding folders (Lib and Include) like I did with GLUT and I can run a program that uses OpenAL so I've got the DLL in the right place too.

For GLUT/OpenGL I've got: -lopengl32 -lglu32 -lglut32

In the linker box. What is this actually telling it to do? And what will I need to use to link OpenAL?

Thanks


You should be able to just link to the OpenAL libraries

-lopengl32 -lglu32 -lglut32 -lopenal32 -lalut



that's all you should need for OpenAL code..

hth,

Share this post


Link to post
Share on other sites
BigDogUK    122
Hmm, I'm still having no luck.

Here's what I've got:

OpenAL32.dll and Alut.dll in Windows/System
OpenAL32.lib and Alut.lib in Dev C++/lib
al.h, alc.h, alctypes.h and altypes.h in Dev C++/Include/AL
alut.h in Dev C++/Include/ALUT

All of these were from the OpenALBetaSDK straight from the OpenAL website except the alut.dll which I can't remember where I found (That could be my problem...)

Now. I've got -lopenal32 -lalut set in my project options.

I'm using:

#include <AL/al.h>
#include <ALUT/alut.h>

When I compile I get quite a few errors referring to ALUT:

In file included from d:\james\...\openal test\main.cpp:19:
C:\DEV-C_~1\Include\ALUT\alut.h:51: `ALCchar' was not declared in this scope
C:\DEV-C_~1\Include\ALUT\alut.h:51: `szDeviceName' was not declared in this scope
C:\DEV-C_~1\Include\ALUT\alut.h:51: `ALCdevice' was not declared in this scope
C:\DEV-C_~1\Include\ALUT\alut.h:51: `ppDevice' was not declared in this scope
C:\DEV-C_~1\Include\ALUT\alut.h:51: `ALCcontext' was not declared in this scope
C:\DEV-C_~1\Include\ALUT\alut.h:51: `ppContext' was not declared in this scope
C:\DEV-C_~1\Include\ALUT\alut.h:51: warning: `__cdecl__' attribute directive ignored
C:\DEV-C_~1\Include\ALUT\alut.h:51: initializer list being treated as compound expression
d:\james\...\openal test\main.cpp: In function `ALboolean LoadALData()':
d:\james\...\openal test\main.cpp:73: `al_bool' undeclared (first use this function)
d:\james\...\openal test\main.cpp:73: (Each undeclared identifier is reported only once
d:\james\...\openal test\main.cpp:73: for each function it appears in.)
d:\james\...\openal test\main.cpp: In function `int main(int, char **)':
d:\james\...\openal test\main.cpp:401: `alutInit' cannot be used as a function


Share this post


Link to post
Share on other sites
BigDogUK    122
Hmm, very confusing. I've got all the stuff in what I assume is the right places, but I still get either those errors if I include the ALUT/alut.h or '-lopenal32 no such file or directory' error.

This guide: http://www.devmaster.net/articles/openal-tutorials/lesson1.php

Helped me learn the code and it worked fine on the Mac. I tried downloading the DevC++ example project but when I open it, it doesn't open the source code or have any of the linking included. Does anyone know what version of DevC++ the example works with?

I've definately got the DLL's in the right place because I can run OpenAL programs without any DLL in the same file as the .exe.

Are there any other coding 'environments' like DevC++ that I could try?

Share this post


Link to post
Share on other sites
Gorax    202
Why people are still using ALut, I don't know (if you bothered to read the documentation, you would have noticed it is being DEPRECATED). If you don't know how to replicate the functions it uses, check the example code (or read the documentation).

That aside, BigDogUK, you really need to pay more attention to the compiler errors. The reason it's complaining about things not being declared is because they aren't. If you bothered to include alc.h BEFORE including alut.h, those compiler errors would completely disappear.

Next time, pay more attention to the errors. Here's a quick rundown of them:
- If variable types don't exist, you'll get the ''<insert type here> was not declared in this scope' error. These errors will usually generate many more because of missing (undeclared) variables.
- If you're missing the static libraries, the error message would be '[Linker error] undefined reference to '<insert function here>''.
- If you're missing the dlls, then Windows would give you an error when you try to run the application, telling you that the dlls are missing.

To repeat what Boris said, I'm not trying to be rude, but programmers *usually* know how to interpret errors generated by the compiler.

Share this post


Link to post
Share on other sites
BigDogUK    122
Hey all. I'm not as stupid as I sound :P Just new to programming and I've been working with Mac's when I started so it's all a bit new to me.

Anyway, I downloaded Visual C++ Express 2005 Beta and have had a lot more success. Compiled my version of Pong with OpenGL/GLUT/OpenAL without too much hassle, got a few errors, but they were pretty easy to fix except for one due to glut.h not working properly with the .NET I found out. Did a bit of Google searching and managed to sort it by altering a line in the actual glut.h.

Anyway, its sorted now. I'm going back to my Mac :P Just wanted to be able to compile the code on Windows if I ever want to show someone who doesn't have a Mac.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this