user3259383
user3259383

Reputation: 149

How to get mingw64 to link to OpenAL on windows

I'm trying to get the latest mingw64 to link to OpenAL.dll. I am using codeblocks 17.12. The problem is there are no source files. The OpenAL SDK just has a lib file and a dll. mingw64 won't link to the lib file, nor the dll. If I try to link to OpenAL32.dll ld.exe crashes and this is the error:

x86_64-w64-mingw32-c++.exe -std=c++98 -Wall -g -O0 -DWIN32 -D_DEBUG -D_WINDOWS -D_CRT_SECURE_NO_WARNINGS -DCODEBLOCKS -DGLEW_STATIC -DGLFW_DLL -std=c++98 -IC:\projects\libs\glfw\include -IC:\projects\libs\bullet\src -IC:\projects\libs\boost -IC:\projects\libs\glew\include -IC:\projects\libs\OpenAL\include -IC:\projects\libs\libpng -IC:\projects\libs\vectorclass -c C:\backup\warlord\Warlord\Warlord\Sound.cpp -o CodeBlocksDebug\Sound.o
x86_64-w64-mingw32-g++.exe  -o CodeBlocksDebug\MercTactics.exe CodeBlocksDebug\AboutScreen.o CodeBlocksDebug\Action.o CodeBlocksDebug\ZoomToBattle.o   -lwinmm C:\projects\libs\glfw-3.2.1\lib\libglfw3.a C:\backup\warlord\Warlord\release\OpenAL32.dll C:\projects\libs\OpenAL\libs\alut.dll C:\projects\libs\glew\lib\libglew32s.a C:\projects\libs\bullet\lib\bullet.a ..\..\..\..\projects\libs\libpng\libpng.a ..\..\..\..\projects\libs\libpng\libzlib.a C:\Windows\System32\opengl32.dll -mwindows
collect2.exe: error: ld returned 5 exit status
Process terminated with status 1 (0 minute(s), 4 second(s))
1 error(s), 0 warning(s) (0 minute(s), 4 second(s))

Upvotes: 0

Views: 921

Answers (1)

user3259383
user3259383

Reputation: 149

After hours of searching, I finally got it working. I used dlltool to create a .a file and then it linked fine

D:\mingw64\x86_64-w64-mingw32\bin\dlltool -d OpenAL 32.def -D OpenAL32.dll -k -a -l libopenal32.a -v

Upvotes: 1

Related Questions