Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Using OpenAL in Windows, LNK2001 error (unresolved external symbol)

I'm trying to port the OpenAL module to work in windows (x64) with Unreal Editor, to use OpenAL instead of XAudio in Windows. To do this, I first changed the build script (UnrealEd.Build.cs) line from:

 if ((Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Win32))



which causes the ALAudio project to attempt to compile. I then had to change some lines in ALAudioBuffer.cpp due to differences between how gcc and VC++'13 handle casts from enumerated types, but I was able to get the code to compile.

In order to link to the proper OpenAL (in my case, OpenAL Soft) libraries, I added the following lines to the OpenAL build script (under ThirdParty\OpenAL\OpenAL.build.cs).

 if (Target.Platform == UnrealTargetPlatform.Win64){
         // add libs for OpenAL 
         PublicAdditionalLibraries.Add(OpenALPath + "lib/Win64/common.lib");
         PublicAdditionalLibraries.Add(OpenALPath + "lib/Win64/OpenAL32.lib");

This resolves most of the link errors that I would normally get (which indicates to me that it is properly linking most of the openAL functions). Note that I've compiled files common.lib and OpenAL32.lib myself from the OpenAL Soft source using VS'13, so the libraries should be compatible with VS'13. I've also placed the library files in the proper directory (I'm using C:\dev\UnrealEngine-release\Engine\Source\ThirdParty\OpenAL\1.15.1\lib\Win64). However, I still get the linker error:

 1>     Creating library C:\dev\UnrealEngine-release\Engine\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-ALAudio.lib and object C:\dev\UnrealEngine-release\Engine\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-ALAudio.exp
 1>Module.ALAudio.cpp.obj : error LNK2001: unresolved external symbol "struct FThreadSafeStaticStat<struct FStat_STAT_AudioResourceCreationTime> StatPtr_STAT_AudioResourceCreationTime" (?StatPtr_STAT_AudioResourceCreationTime@@3U?$FThreadSafeStaticStat@UFStat_STAT_AudioResourceCreationTime@@@@A)
 1>C:\dev\UnrealEngine-release\Engine\Binaries\Win64\UE4Editor-ALAudio.dll : fatal error LNK1120: 1 unresolved externals

I'm not sure how to interpret this linker error, as I'm using the correct (AFAIK) headers and libraries for VS'13 (since I've built them myself).

Any help with this would be appreciated.

Product Version: Not Selected
more ▼

asked Jan 04 '15 at 05:29 AM in C++ Programming

avatar image

1 1 3 4

avatar image zompi2 Jan 04 '15 at 04:38 PM

As far as I can see the ALAudio module is for Linux and HTML5 only.

When you use PublicDependencyModuleNames.Add("ALAudio"); the UBT is trying to build a registered module which in this case is inside the Runtime/Linux and Runtime/HTML5 directories. I'm not sure if UBT is using those directories when building Win64.

To make it work on Windows you should make a module in Source/Runtime/Windows that implements the OpenAL or try to move it to the Source/Runtime. You can look at libcurl how it is done.

The interesting thing is that I can't find an ALAudio.cpp file :/

I don't have full sources on this computer, but I know you went to the quite deep engine stuff here ;)

avatar image Zuofu Jan 04 '15 at 10:36 PM

Turns out the problem is that how some performance metrics were done on Linux is different than on Windows, so the reference to AudioResourceCreationTime doesn't exist on the windows platform. I just removed that reference, it builds fine, and even runs and instantiates an OpenAL device "Generic Software", but there's no sound yet. It's close though, I bet I can figure it out with some more debugging.

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

I did some more research and was able to get OpenAL working correctly under Windows. The key to getting it to link properly is to comment out the line:

 SCOPE_CYCLE_COUNTER( STAT_AudioResourceCreationTime );

which in the file ALAudioBuffer.cpp. This relates to some performance metric mechanism which doesn't seem to work the same way under Windows. I also had to modify the file ALAudioDevice.cpp and add PLATFORM_WINDOWS to the following pre-processor #ifs, to make OpenAL actually register itself as the audio context: e.g:

     SoundContext = alcCreateContext( HardwareDevice, Caps );

After these changes (and the above ones I've already stated in my question), OpenAL seems to work fine under Windows. Of course, you have to ensure that it uses ALAudio as the audio module, by editing WindowsEngine.ini:

more ▼

answered Jan 05 '15 at 04:14 AM

avatar image

1 1 3 4

(comments are locked)
10|2000 characters needed characters left

Zuofu, can I download files that you changed for OpenAL use? And will it work with Rapture3D OpenAL? Thanks! :)

more ▼

answered Nov 28 '17 at 02:40 PM

avatar image

21 2 5 10

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question