GCC command to compile

Could someone please show me an example of compiling the source code for one of the sample programs here on the command line?

Comments

  • Hi fistfullofnails,

    Here it is the command line to compile latest raylib examples:

    gcc -o my_game.exe my_game.c -I../../src -Iexternal -lraylib -lopengl32 -lgdi32 -std=c99

  • edited June 17
    I get "raylib.h: No such file or directory" when I enter the command. I am running Ubuntu if that is of any difference. I see the raylib.h file in the raylib/src directory. Which directory should I be in when trying to run the command example you gave me? I'm very stupid, so some things you think might be obvious could be going right over my head.
  • ok, to compile for Ubuntu you need the following line:

    gcc -o my_game.exe my_game.c -I../../src -Iexternal -lraylib -lGL -lm -lpthread -ldl -lrt -lX11

    Just make sure that -I{path_to_raylib.h} is defined properly.
  • edited June 17
    Now it says:

    /usr/bin/ld: cannot find -lraylib
    collect2: error: ld returned 1 exit status

    This is what I put in for the path:

    /home/matt/raylib/src
  • Also add -L{path_to_libraylib.a}
  • Strangely enough, in my case, I couldn't compile because the target directory didn't exist. After I created the folders manually, it compliled with no problems.
  • By the way my system is Windows 8.1 64bit, using mingw.
  • yeah, I'm aware of that issue...
  • I forgot to give congrats for the 2.0 release. The reason I stepped into this folder problem is because I'm trying to write a Python binding for raylib. At the moment it seems to work ok under Python3.7 32bits on Windows (didn't tested heavily yet) but i'll have to look for help on the other platforms. There's a lot to do.
  • oooh! That sounds amazing to me! A Python binding was a missing piece for raylib! Please, keep me updated with your progress! :D
Sign In or Register to comment.