I am working on a personal project where I use SFML in my C++ code. When I created the project in VS Code a few weeks ago, I added the sfml using WSL. I noticed that IntelliSense wouldn't recognise SFML classes, and writing <SFML/...> would result in succesful compilation. This means the library is correctly included and linked during the build process. But I cannot seem to get IntelliSense to work with SFML.
For example, writing: sf::
would not show a list of suggestions. When writing sf::Sprite sprite
would leave sf colored blue and not green and Sprite white as opposed to blue, how it should be. Plus, when I hover above a definition of a class method in my project, I get a message saying "error-type".
I tried restarting VS Code, IntelliSense and I added a lib folder to my project where I added the SFML folder. The latter worked one evening. When I restarted my computer next day, it didn't work anymore. I also tried adding the path to the include folder in the c_cpp_proprties.json file.
I have looked around for any tutorials but none have worked so far. I do not need to compile my code through VS Code, I just need it to know SFML (mostly for autocompletion).
EDIT: I opened the project next day and the error changed. The "error-type" is gone but now all my SFML includes are underlined in red:
Go to settings (Shift-Control-P) and open "Remote Settings"
In that screen enter "include path" in the search box
Make sure it's under the Remote tab.
Then look for "C_Cpp Default: Include Path".
Click on "Add Item"
Add the path to your SFML includes in there.