I'm having difficulties installing the OpenAL audio library in C++. I guess the headers are in the correct folder and the problem is in the lib files, because VS Code doesn't show any error when I include the library (#include <AL/al.h>
and #include <AL/alc.h>
), but when I try to compile my code from the terminal I get the following error:
C:\Users\ALEXAN~1\AppData\Local\Temp\ccNZ4t3C.o:Proves.cpp:(.text+0x1c): undefined reference to `__imp_alcOpenDevice'
C:\Users\ALEXAN~1\AppData\Local\Temp\ccNZ4t3C.o:Proves.cpp:(.text+0x30): undefined reference to `__imp_alcCloseDevice'
collect2.exe: error: ld returned 1 exit status
Where and how I've installed the library:
I've downloaded and unziped the Windows binaries. Then I've run the cpp -v
command to find the C++ include directories, which showed 3 directories. I moved the AL
folder (that contains the headers) to the C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include
directory and the Win32 lib files (called libOpenAL32.dll.a
, OpenAL32.def
and OpenAL32.lib
) to the C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\lib
directory. I'm not sure if I have to put there the 3 of them or just the one called libOpenAL32.dll.a
.
I know there are similar posts on stackoverflow and I've read some of them, but it's the first time I install a library in C++ and it's difficult for me to understand them. If someone could provide a clear explanation on how to complete the installation I'd be very grateful.