Using Boost with Emscripten

前端 未结 6 1902
广开言路
广开言路 2020-12-07 18:08

I have a c++ project I would like to convert to a web application. For this purpose, I would like to use Emscripten to build the project.

The project uses some exter

6条回答
  •  盖世英雄少女心
    2020-12-07 18:19

    I don't know if you've happened to see this particular question in the FAQ, but in case you haven't:

    Q. How do I link against system libraries like SDL, boost, etc.?

    A. System libraries that are included with emscripten - libc, libc++ (C++ STL) and SDL - are automatically included when you compile (and just the necessary parts of them). You don't even need -lSDL, unlike other compilers (but -lSDL won't hurt either).

    Other libraries not included with emscripten, like boost, you would need to compile yourself and link with your program, just as if they were a module in your project. For example, see how BananaBread links in libz. (Note that in the specific case of boost, if you only need the boost headers, you don't need to compile anything.)

    Another option for libraries not included is to implement them as a JS library, like emscripten does for libc (minus malloc) and SDL (but not libc++ or malloc). See --js-library in emcc.

提交回复
热议问题