Custom(file_write,stderr) cpp target with embedded sounds

I have a haxeflixel game that crashes randomly when targeting cpp with an error message of Custom(file_write,stderr)

I’ve determined that it happens when playing an embedded sound, although only occasionally, and the program exits with the generic error message. When removing embed="true" from my asset tags for sounds it doesn’t happen, as far as I’ve tested. I prefer to embed my assets though. I’ve tried with both OGG and WAV files with same result.

In my search for answers I found this and it looks like the same issue.
https://github.com/openfl/openfl/issues/521

jgranick commented on May 20, 2015
There was a file handle leak that could occur before (depending on which code paths your project followed down), which could lead to valid sounds not loading. Resolved in newer versions :smile:

Is there a way I can fix this with the older openfl/lime versions I’m using?

|haxe:|3.2.0|
|flixel:|4.3.0|
|hxcpp:|3.4.64|
|lime:|2.9.1|
|openfl:|3.6.1|

Thanks for any help with this.

This is telling you that it called the file_write() function with stderr as an argument, and then file_write() threw an error. So there already was an error, and it tried to tell you about the error by opening up stderr, and that crashed.

Someone already explained this in the GitHub thread you found, but I’m explaining it again in case someone comes to this thread. Sadly I can’t help beyond this.

Thanks.

I found the error that caused the file_write error to be a sound problem when they’re embeded. It’s always when playing a sound but random. Joshua’s comment on github said there was a file handle leak that’s fixed in the newer versions. I’d like to know how I can fix the file handle leak in the older version 3.6.1.

The good news is that I know what caused the error. If I don’t embed the sounds it’s fine. But I’d rather embed them.

HaxeFlixel right? We need to get Flixel on a newer version :frowning:

Yes. It will be great. For now, I guess I won’t embed the sounds.