rxi / microui

A tiny immediate-mode UI library
MIT License
3.29k stars 239 forks source link

Question: Running demo on windows #61

Open ryanalbrecht opened 1 year ago

ryanalbrecht commented 1 year ago

Forgive as I am new to C and just messing around breaking things as I learn.

Is it possible to run the demo on windows? It seems the compiler does not like the SDL2 library.

./build.sh: line 13: sdl2-config: command not found
main.c:1:10: fatal error: SDL2/SDL.h: No such file or directory
    1 | #include <SDL2/SDL.h>
      |          ^~~~~~~~~~~~

I have tried downloading the SDL2 library and including but I cannot seem to get this to work. Would anyone be kind enough to instruct me how to get this to work?

SushilRagoonath commented 1 year ago

Use -i with your compiler to allow it to see the headers. these are .h are include/ .You will then need to link the library using -l which are under /lib I think. Things may take a while to understand but it will eventually make sense. Here is an example build command using the visual studio compiler. cl demo\main.c demo\renderer.c -I SDL2-2.0.14\include -I src\ SDL2-2.0.14\lib\x64\SDL2.lib SDL2-2.0.14\lib\x64\SDL2main.lib opengl32.lib Download A recent version of SDL2 here, SDL2-devel-* will be easier since you don't need to compile them. Post again if you get more specific errors, I have encountered some in the past. https://github.com/libsdl-org/SDL/releases

kennethrapp commented 1 year ago

Add the folders for SDL to your include path and change the include to #include "SDL.h"

Also if you use the Geometry API, you don't need to include OpenGL as in the example.