Dependencies when using SoundCue in c++

I am trying to add some sound effects to my game. I am using the PlaySound2D function to play a SoundCue. I got an error saying that it can’t convert from USoundCue to USoundBase. I found [this][1] post about that error. The sound works if I change from EngineMinimal.h to Engine.h. However, this makes my .apk file much bigger, so I cannot do that. I have to use EngineMinimal.h.

Which spcific includes do I need in my .cpp for it to work? I have SoundDefinitions.h included. I also tried SoundCue.h, but then I get the error “Cannot open include file: ‘SoundCue.h’: no such file or directory”.

Many thanks.
[1]: https://answers.unrealengine.com/questions/91599/how-to-use-setsound.html

I fixed this by copying SoundCue.h from Source/Runtime/Engine/Classes/Sound to Source/Runtime/Engine/Public.

Is that ok, or should this be done some other way?

thanks

This only worked one time. The scond time I compiled I got the error “C://Program Files (x86)/Eoic Games/4.11/Engine/Source/Runtime/Engine/Public/SoundCue.h(11): struct: ‘SoundNodeEditorData’ conflicts with class name”.

Why did this work once, but now it won’t compile. What can I do to get it working?

So whenever I make a change in my code and try to compile I get “C://Program Files (x86)/Eoic Games/4.11/Engine/Source/Runtime/Engine/Public/SoundCue.h(11): struct: ‘SoundNodeEditorData’ conflicts with class name”.

Deleting the SoundCue.h file from the public folder, and then trying to compile gives the converting from soundcue to soundbase errors again. Copying the header file to the public folder gives successful compilation one time only.
How can I include SoundCue.h without having to delete it and copy it back in all the time?

bumpy mcbump

I tried copying the header file to my project source directory, but that gives an error.
I tried including the SoundCue.h file in the the EngineMinimal.h file, but that did absolutely nothing.

Hey Pesk92-

You first want to make sure you are including Runtime/Engine/Classes/Sound/SoundCue.h in the class that is to use SoundCue. Additionally, if you are having issues related to the SoundCue class being minimal_api, you can open the file and mark specifically the functions you want to use with Engine_API. If you still have problems after these changes, please indicate how you are using SoundeCue with sample code or screenshots for additional information.