1
votes

I've tried to compile this SDL2 tutorial using emscripten: Text input tutorial

But I've got this error:

error: unknown type name 'SDL_RendererFlip'; did you mean 'SDL_RendererFlags'?
error: use of undeclared identifier 'SDL_RenderCopyEx'

The <SDL/SDL.h> is included. I have no idea why the compiler cannot find the enum, and the function.

https://wiki.libsdl.org/SDL_RendererFlip
https://wiki.libsdl.org/SDL_RenderCopyEx


The command line arguments are:

emcc main.cpp -o main.html --preload-file files@/ -s USE_SDL=2 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS=['bmp'] -s USE_SDL_TTF=2

The includes at the beginning of the code:

#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
#include <SDL/SDL_ttf.h>
#include <emscripten.h>
#include <stdio.h>
#include <string>
#include <sstream>
1

1 Answers

1
votes

#include <SDL/SDL.h> includes emscripten built-in SDL 1.3.

#include <SDL.h> will use emscripten-ports SDL2.