From 02a09672434295b657274edba8969a1d4ca3f18d Mon Sep 17 00:00:00 2001 From: Daniel Gibson Date: Thu, 16 Jul 2015 03:54:44 +0200 Subject: [PATCH] Fix SDL2-example for Linux The header is called "SDL_opengl.h" - case matters on Linux. The main() function must indeed be called main(), on Windows it'll be renamed to SDL_main (for SDL2main.lib) by #define in SDL_main.h (which is included by SDL.h) I added an entry to the example's README that describes how to build it on Linux. --- examples/sdl_opengl_example/README.md | 6 ++++++ examples/sdl_opengl_example/imgui_impl_sdl.cpp | 2 +- examples/sdl_opengl_example/main.cpp | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/examples/sdl_opengl_example/README.md b/examples/sdl_opengl_example/README.md index de553f304..0afb09312 100644 --- a/examples/sdl_opengl_example/README.md +++ b/examples/sdl_opengl_example/README.md @@ -8,3 +8,9 @@ ``` cl /MD /I /I ..\.. main.cpp imgui_impl_sdl.cpp ..\..\imgui.cpp /link /LIBPATH: SDL2.lib SDL2main.lib ``` + +- On Linux and similar Unices + +``` +c++ `sdl2-config --cflags` -I ../.. main.cpp imgui_impl_sdl.cpp ../../imgui.cpp `sdl2-config --libs` -lGL -o sdl2example +``` diff --git a/examples/sdl_opengl_example/imgui_impl_sdl.cpp b/examples/sdl_opengl_example/imgui_impl_sdl.cpp index 9bac09591..10260d2d9 100644 --- a/examples/sdl_opengl_example/imgui_impl_sdl.cpp +++ b/examples/sdl_opengl_example/imgui_impl_sdl.cpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include "imgui_impl_sdl.h" diff --git a/examples/sdl_opengl_example/main.cpp b/examples/sdl_opengl_example/main.cpp index e64d2265c..e2d236678 100644 --- a/examples/sdl_opengl_example/main.cpp +++ b/examples/sdl_opengl_example/main.cpp @@ -4,9 +4,9 @@ #include "imgui_impl_sdl.h" #include #include -#include +#include -int SDL_main(int, char**) +int main(int, char**) { // Setup SDL if (SDL_Init(SDL_INIT_EVERYTHING) != 0)