Raylib.h not found?

I started CPP course a while ago and everything worked just fine. Unfortunately, some personal issues forced me to stop learning. Now I want to return but I’ve realized that VS Code cannot find raylib.h. Debugging shows exactly this error:

‘raylib.h’ file not found clang(pp_file_not_found)

I’ve already reinstalled Raylib to default folder, C:\raylib, as well as the files provided by Stephen but no matter what I do, I am still getting this error.

Can I ask you for your help?

Hello Jindrich,

What operating system are you using? Did you install the most recent version of Raylib and are you using the most recent version of our project template? (I ask because some folder locations got changed between Raylib versions since the course started)

Hello Tuomo,

I am using Win 10, and yes, I’ve installed the most recent version of Raylib when reinstalling. And I downloaded again all templates of the project. Also, I cannot select the correct compiler as suggested in GitLab. It says this:

Starting build…
C:/raylib/w64devkit/bin/gcc.exe -fdiagnostics-color=always -g C:\Users\jungm\OneDrive\Plocha\cpp_course\vscode-template-main\vscode-template-main\axe_game.cpp -o C:\Users\jungm\OneDrive\Plocha\cpp_course\vscode-template-main\vscode-template-main\axe_game.exe
gcc.exe: fatal error: cannot execute ‘as’: CreateProcess: No such file or directory
compilation terminated.

Build finished with error(s).

  • The terminal process failed to launch (exit code: -1).

(w64devkit is the new path file for g++.exe, when trying C:\raylib\mingw\bin\g++.exe nothing happens since the folder doesn’t exist anymore)

So… nobody can help me? Ok…

Sorry for the delayed response. Where is your CPP file located your project?

Edit for additional context: When using the Build Debug or Build Release task to compile your project, the compiler assumes that all CCP files are located at the root of your project folder. This error can come about if your CPP file is in a folder inside of your project. Such as the .vscode folder.

Hi Tuomo, no worries. I am happy you’re back and trying to help.

I’ve created my default CPP file in vscode-template-main folder among other root files, not in .vscode or any other folder. Also, I’ve downloaded axe-game-master folder from gitlab.com just to check if the error appears in Stephen’s projects as well. And it does.

The path of Stephen’s axe-game.cpp I’ve downloaded:

Also, I’ve checked the COMPILER_PATH in Makefile for VSCode in C:\Raylib folder and compare it with Makefile in course folder. They don’t match.
Compiler Path in C:\raylib\raylib\projects\VSCode\Makefile:


Compiler Path in C:\Users\jungm\OneDrive\Desktop\cpp_course\axe-game-master\axe-game-master\Makefile:


I am starting to think that the error can be caused by new version of Raylib. Maybe VSCode cannot find the correct compiler path?

The error is happening in the master projects because they haven’t been updated for the filepath changes that happened in Raylib 4.0, it’s better to compare with our template vs the provided-by-raylib template. Our template being the one that’s expected to be used for the course.

That said: If you want to use the master projects then all you need to do to get them to compile (assuming no issues with your setup) is to copy the .vscode folder and the makefile. I can see if we can get the masters updated so they work without this needed step.

Ok, I see there is the correct path in Makefile file in your template I’ve downloaded and use all the time but the error is still there. Neither your VSC template nor your axe-game template work with current version of Raylib 4.5.
I was looking for later version, 4.2., but I cannot find any downloadable links on Raylib’s github.

But since everything worked just fine few months ago, and I’ve reinstalled Raylib only now to see if it repairs this error I don’t think the new version is the answer. But maybe I am wrong. Right now I am so confused from reading all the possible solutions all over the internet that I doubt my own name. :smiley:

The paths haven’t changed in 4.5, they changed in 4.0 (I reinstalled 4.5 to double-check). So there’s an issue with your project or somewhere between your project and the compiler (Windows can be weird at times).

If you haven’t already, add the raylib folder as an exception in your antivirus as Raylib can be flagged as a false positive.

As an additional step to help isolate the issue, can you upload your project using this form? That way I can troubleshoot it more directly.

Ok, done.

Thanks again.

Ok, when I try to compile the project here I don’t get any errors. That said, I did run into an interesting possibility. What’s the full file path to your project on your PC?


I am all ears. :smiley:

Try shortening that path a bit, you might be hitting a weird character limit for filepaths with the compiler. I did initially when I tried unzipping your project in my downloads folder, which wouldn’t be that far off in length from your OneDrive. Once I shortened the length of the path then I could compile.

Also, OneDrive isn’t the best place to work on coding projects in general. So try moving the project to your documents folder or somewhere not covered by OneDrive.

Nah, still not working.

I am pretty tired of it to be honest. I am thinking of giving up. Obviously there’s no problem with Raylib or the course, it looks that only my computer is on strike. Or the problem is between PC and chair, who knows.
Unfortunately, my laptop is broken so I cannot try it there.

Well, Tuomo, thanks anyway. I appreciate your commitment.

If you're seeing an error regarding raylib.h not being found, consider the following troubleshooting steps:

  1. raylib Installation Location:
    • Ensure that raylib.h is indeed in the C:\raylib\raylib\src directory (or wherever you've installed raylib). Sometimes, the header files might be in a sub-directory.
  2. Check Your Configuration:
    • Open the .vscode folder in your project root.
    • Look for c_cpp_properties.json. This file contains configuration details for the C/C++ extension in VS Code.
    • Check the includePath property to ensure that it has the path to the raylib.h file. It should look something like this:
      "includePath": [
  3. Compiler Flags:
    • If you're compiling your code manually or using a script, make sure you're passing the correct include flag to your compiler. For gcc or clang, it's typically -I, followed by the path to the include directory.
      gcc your_code.c -I"C:\raylib\raylib\src" -o output.exe
  4. Check Your #include Statement:
    • Make sure you're using the correct #include statement. If raylib is installed in a standard location, you might need:
      #include <raylib.h>
    • If it's in a relative path from your source code, you might need:
      #include "raylib.h"
  5. Extensions:
    • Ensure you have the necessary VS Code extensions installed, such as the Microsoft C/C++ extension. If they are installed, sometimes disabling and re-enabling them (or even uninstalling and reinstalling them) can help.
  6. Clean & Rebuild:
    • If you're using a build system, sometimes leftover files from previous builds can cause issues. Try cleaning (removing all generated build files) and rebuilding the project.
  7. Restart VS Code:
    • Close and re-open VS Code. Sometimes the simplest solutions can be the most effective.
  8. IntelliSense:
    • If you're able to compile the code correctly, but VS Code is showing an error, it might be an IntelliSense issue, and not an actual error. You can try resetting IntelliSense by pressing Ctrl + Shift + P and searching for "C/C++: Reset IntelliSense Database".
1 Like

Thanks for trying but nothing works/all is correctly set up.
Don’t worry about it, I am giving up.

Do you have more than one C++ extensions installed? That seemed to be the initial problem for me

Privacy & Terms