SFML community forums

Help => General => Topic started by: hzinsanoglu on May 15, 2022, 01:54:05 pm

Title: C++ cannot open source file
Post by: hzinsanoglu on May 15, 2022, 01:54:05 pm
I am new to SFML and Visual Studio. I followed a tutorial on youtube to implement SFML and it went fine up untill the end when I tried to run an example. Now, although I included all the files etc. in project properties section it won't see the files and throw an error at include. What should I do? Please explain in a way easy to understand as I am newbie. I included an image in the attachments.

Severity   Code   Description   Project   File   Line   Suppression State
Error   C1083   Cannot open include file: 'SFML/Graphics.hpp': No such file or directory   SFML   C:\Users\Mert\source\repos\SFML\SFML\SFML.cpp   1   
Title: Re: C++ cannot open source file
Post by: Stauricus on May 15, 2022, 03:01:54 pm
well, simply put, Visual Studio isn't finding the header file Graphics.hpp.
in what folder exactly did you put the SFML headers and etc? can you show us the complete folder path?
Title: Re: C++ cannot open source file
Post by: hzinsanoglu on May 15, 2022, 08:45:58 pm
well, simply put, Visual Studio isn't finding the header file Graphics.hpp.
in what folder exactly did you put the SFML headers and etc? can you show us the complete folder path?

I am terribly sorry for the late reply despite your early help. If you are asking for the pathway where teh downloaded sfml file is, it is C:\Users\Mert\SFML-2.5.1 . However, if you meant the source files included for the project specifically it is C:\Users\Mert\source\repos\SFML and in it is a different SFML file with x64 file (debug and release).
Title: Re: C++ cannot open source file
Post by: Stauricus on May 16, 2022, 05:52:34 pm
the source files. have a check if the path is correct, it contains the SFML folder twice in your error:
C:\Users\Mert\source\repos\SFML\SFML\SFML.cpp

try to include files in your source code just with
#include "Graphics.hpp"

OR

change the configurations from Visual Studio to look for header files in the path "C:\Users\Mert\source\repos\" instead of "C:\Users\Mert\source\repos\SFML\".