3
我想創建一個OpenGL + SDL2程序,並使用Emscripten進行編譯。但不幸的是,我不能甚至開始,因爲我得到一個錯誤的包括:不同類型的Typedef重定義(Emscripten SDL2 + OpenGL)
#include <iostream>
#include <string>
#include <emscripten.h>
#include <SDL.h>
#include <SDL_image.h>
#include <SDL_ttf.h>
#define GLFW_INCLUDE_ES2
#include <GL/glew.h>
#include <SDL_opengles2.h>
#include <GL/glu.h>
的錯誤是:
D:\Emscripten\emscripten\1.35.0\system\include\GLES2/gl2.h:39:26: error:
typedef redefinition with different types ('khronos_ssize_t' (aka 'long')
vs 'ptrdiff_t' (aka 'int'))
typedef khronos_ssize_t GLsizeiptr;
的#define GLFW_INCLUDE_ES2
線以後增加了,但它並沒有解決問題。
我用這個參數編譯:
USE_SDL=2 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS=['png'] -s USE_SDL_TTF=2
出於好奇:爲什麼使用C++程序一個C API的圖形?像SFML這樣的圖形api更適用於C++程序。 – Boiethios