MeasureTextEx make my programme crash


today I was working on a pong project (yes i'm a beginners in game development :D) and wanted to align my text in the middle of the screen. So I used the MeasureTextEx function but when I compile and run, the programme crash :

Any fix ?


  • Could you share the full code?

    In any case seems related to player1Name, those crashes are usully related to out-of-memory access, and mostly involved with pointers...
  • edited July 2017
    Here is the source code : (sorry for the quality of it)

    This function is supposed to be called at lines : 140, 142, 155 and 157. And yeah when trying to debug with VStudio I got the out of memory exception so.

    PS. Is the forum use markdown or something like that ?
  • Ok, I think that's because you are trying to call MeasureTextEx() before LoadSpriteFont(), so font is no loaded...
  • By the way, I think there is some kind of markdown with < code > and < / code >
  • Yeah it work thanks.

    Any simple way to create a project with more than 1 file ?
  • check raylib/templates folder
  • Yeah found that already and that's why I ask for a "simple way" ^^ . I'm not that comfortable with the command line compilation. I've never write myself a makefile.
  • basically you compile all the .c files together, functions are referenced between files using the .h. Notepad++ includes a script to run Makefiles
  • edited July 2017
    I've decided to create a template in Visual Studio for raylib project.

    Basicly i've done everything but I still get this error : **impossible d'ouvrir le fichier 'openal32.lib'**

    I've follow every steps in the wiki for create a game project :neutral:

    EDIT: The error message is english is "Unable to open le file "openal32.lib"
  • check raylib/project/vs2015 a already prepared project is available...
  • So I can't have a simple project ? I need to compile Raylib and have one other project in my solution who depend on the raylib one ? I try to understand but that's pretty weird for a beginners. Why I can't just create a simple project like I do with SDL ?
  • You can just have a solution with your raylib project, no raylib-library project included.

    I just included raylib-library project in the solution because most of the users will feel very comfortable having the library available in case they want to add/remove/edit anything. That's a pretty professional way to work on projects, for example, very common when coding Unreal-based games (professional studios).

    You can just included in raylib project the reference to compiled raylib.lib and remove raylib-library project from solution.
  • Ok I guess I'll work like that then.

    I've read some stuff about Makefile and i've one question. Why do you create a new segment like that everytime you add a file when you can just update your SCREENS variable like that : (this example work exactly like your's but all source are in the root folder and not in screens folder).
  • Just did that way because it was easier to understand that every file is compiled independently than use a quite complex to understand line that processes all file.
Sign In or Register to comment.