0

Using Visual Studio 10, I have failed to compile the example codes provided by openal

http://connect.creativelabs.com/openal/Downloads/Forms/AllItems.aspx

I've installed OpenAL11CoreSDK, executing oalinst.exe, also download freealut-1.1.0-bin
I've copied all files inside of "OpenAL 1.1 SDK\ include" to "Microsoft Visual Studio 10.0\VC\include\AL", also alut.h inside freealut-1.1.0-bin
I put alut.lib and OpenAL32.lib in "Microsoft Visual Studio 10.0\VC\libs" I put alut.dll and OpenAL32.dll in "C:\Windows\SysWOW64" and "C:\Windows\System32"
I have included the path of "Microsoft Visual Studio 10.0\VC\include\AL" in "Project->Properties->VC++ Directories->Include Directories" and "C/C++ ->General->Additional Include Directories"
"VC\lib" in "Library Directories" and "Linker->General->Additional Library Directories" the path of "alut.lib" and "OpenAL.lib" in "Linker->Input->Additional Dependencies"

I think I've linked all libraries, but I still get linker errors:

1>test.obj : error LNK2019: unresolved external symbol __imp__alSourcePlay referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol __imp__alSourcei referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol __imp__alGenSources referenced in function _main<br>
1>C:\Users\SONY\Documents\Visual Studio 2010\Projects\test\Debug\test.exe : fatal error LNK1120: 3 unresolved externals


#include <stdlib.h>
#include <AL/alut.h>

/*
  This is the 'Hello World' program from the ALUT
  reference manual.

  Link using '-lalut -lopenal -lpthread'.
*/

int
main (int argc, char **argv)
{
  ALuint helloBuffer, helloSource;
  alutInit (&argc, argv);
  helloBuffer = alutCreateBufferHelloWorld ();
  alGenSources (1, &helloSource);
  alSourcei (helloSource, AL_BUFFER, helloBuffer);
  alSourcePlay (helloSource);
  alutSleep (1);
  alutExit ();
  return EXIT_SUCCESS;
}

I'm lost, what am I doing wrong?

Shafik Yaghmour
  • 154,301
  • 39
  • 440
  • 740
millie
  • 11
  • 3

1 Answers1

1

Getting OpenAL and ALUT to work just took three guys about 5 hours. I'm sure my issues were different than yours, but I also feel sure that after you fix that problem, you'll just run into another one. Unlike other posters, I'm not going to address your question with an answer - I don't believe there is a single one that will work for everyone.

Step 1 : Install oalinst.exe . This is the installer for OpenAL. We were not able to get OpenAL to work at all without using the installer. This part is especially tricky because there are multiple versions running around all with the same file name. You want the newest version that there is. At the time of writing, the one I'm using is June 02, 2009. You can find these dates by right-clicking on the file and going to Properties->Digital Signature.

In our case, the oalinst installs an OpenAL32.dll in System32 and SysWow64 ; there is also an OpenAL32.dll inside the OpenAL CoreSDK - all of these are different.

Step 2 : Make sure your program is as dummed down as possible. Your hello world from OpenAL is just fine.

Step 3 : Make sure you have FreeALUT.

Step 4 : Check your dependencies in Visual Studio. Right-click the project in Visual Studio (that is, the thing right below the solution in the Solution Explorer tree), and go to

Properties > Configuration Properties > C/C++ > General > Additional Include Directories (more).

STUFF\OpenAL\OpenAL 1.1\include
STUFF\OpenAL\freealut-1.1.0-bin\include
STUFF\OpenAL\OpenAL 1.1\include\AL

Make sure that STUFF matches the directory structure you have. Save yourself some frustration later and check that the path you typed can be copy-pasted into windows explorer and land you in the right place.

Now, Properties > Configuration Properties > Linker > General > Additional Library Directories (more).

STUFF\OpenAL\OpenAL 1.1\libs\Win32
STUFF\OpenAL\freealut-1.1.0-bin\lib

Same deal as last time.

Lastly, Properties > Configuration Properties > Linker > Input > Additional Dependencies.

OpenAL32.lib
alut.lib

.

  1. Make sure to CLOSE Visual Studio. Make Clean. Remake. Run. If you switch from Debug to Release, remember that you will need to redo the property pages.

The rest is up to you. When you build your release or debug version, alut.dll and alut.lib should appear in the respective Debug or Release folder.

Don't be afraid to just try to run the compiled executable without Visual Studio (ie, just by double clicking on the hello_world.exe)

rlb.usa
  • 14,942
  • 16
  • 80
  • 128