Search Unity

VSCode emscripten includePath?

Discussion in 'Web' started by De-Panther, Jun 23, 2020.

  1. De-Panther

    De-Panther

    Joined:
    Dec 27, 2009
    Posts:
    589
    Hi,

    I'm using VSCode. In my Unity project I have C#, JS and C files, the VSCode works fine with C# and JS, but with the C files (in Assets/Plugins/WebGL) I have include issues.

    If I'm not defining the emscripten path in the VSCode c_cpp_properties.json file, I get error
    cannot open source file "emscripten.h"
    for
    #include "emscripten.h"

    If I'm defining the path (e.g. to the Unity emscripten install path
    "UNITY_INSTALL_PATH\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\system\include\**"
    or
    "UNITY_INSTALL_PATH\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\system\**"
    ), I get the error
    expected a type specifier
    when using EMSCRIPTEN_KEEPALIVE

    I also tried to install emscripten from the upstream, and include the new path instead, but I keep getting this error.

    It does find the EMSCRIPTEN_KEEPALIVE define line, but still give this error when using it.

    The code compiles, I just want to have the IDE to work properly.

    Thanks
     
  2. De-Panther

    De-Panther

    Joined:
    Dec 27, 2009
    Posts:
    589
  3. De-Panther

    De-Panther

    Joined:
    Dec 27, 2009
    Posts:
    589
    Found a solution
    To "includePath", add
    "UNITY_INSTALL_PATH/Editor/Data/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/system/include"

    "compilerPath" should be
    "UNITY_INSTALL_PATH/Editor/Data/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/em++.bat"

    and "intelliSenseMode" should be "clang-x64"
     
  4. De-Panther

    De-Panther

    Joined:
    Dec 27, 2009
    Posts:
    589
    Also had to add to the "includePath":
    "UNITY_INSTALL_PATH/Editor/Data/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/system/lib/libc/musl/arch/emscripten",
    "UNITY_INSTALL_PATH/Editor/Data/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/system/include/libc",