Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Running demo on windows #61

Open
ryanalbrecht opened this issue Nov 2, 2022 · 2 comments
Open

Question: Running demo on windows #61

ryanalbrecht opened this issue Nov 2, 2022 · 2 comments

Comments

@ryanalbrecht
Copy link

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
Copy link

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants