Search code examples
linuxcocos2d-xcocos2d-x-3.0

How to include SimpleAudioEngine to Linux build in cocos2d-x v3.3 project?


I'm trying use SimpleAudioEngine in my project. I include the SimpleAudiEngine header to AppDelegate.

#include "SimpleAudioEngine.h"

When I build my project for Android everything compiles and build is fine. SimpleAudioEngine working is correct. If run build for Linux, I get an error message:

    fatal error: SimpleAudioEngine.h: No such file or directory
#include "SimpleAudioEngine.h"

I tried include SimpleAudioEngine to CMake file - result remains the previous.


Solution

  • I solved the problem by adding this line of code to CMakeLists.txt (in cocos2D version 3.4 project):

    ${COCOS2D_ROOT}/cocos/audio/include

    So CMakeLists.txt is somthing like this now:

    ...
    
    include_directories(
    
        /usr/local/include/GLFW
    
        ...
    
        ${COCOS2D_ROOT}/cocos/audio/include
    
    )
    

    hope this help.