SFML community forums

Help => General => Topic started by: KeegPNW on October 05, 2021, 07:36:17 am

Title: Cannot open include file: 'SFML/Graphics.hpp': No such file or directory...
Post by: KeegPNW on October 05, 2021, 07:36:17 am
Hello peoples,

I wanted to avoid making yet another topic on this forum around this kind of issue, but much forum and general internet searching has gained me nothing but frustration.

I am using Visual Studio 2019 on Windows 10 with SFML 2.5.1 and after following the corresponding tutorial on first the SFML site and then many on YouTube, I was met with editor errors related to the inability to find the include directory ("cannot open source file 'SFML/Graphics.hpp') and of course the compiler error "Cannot open include file: 'SFML/Graphics.hpp': No such file or directory".

I have ensured the directory of the include and library folders are correct and applied to all configurations+platforms, as well as the dependencies for release and debug. If it matters, the "SFML-2.5.1" folder is located in "C:\Libraries". I am using the exact template code used in the Visual Studio setup tutorial on the SFML website. All these things were copy-pasted, to ensure minimum chance of goof, but here are some images because more eyes is better:

https://ibb.co/6Zsrtr1
https://ibb.co/G255zJ8
https://ibb.co/QcXDNHG
https://ibb.co/XCcnJ52

Thanks for your time and help, please tell me if additional details are necessary (I'm sure I forgot something)!
Title: Re: Cannot open include file: 'SFML/Graphics.hpp': No such file or directory...
Post by: texus on October 05, 2021, 09:27:22 am
In the first screenshot you have "C:\SFML-2.5.1\include" for "Additional Include Directories". This should probably be "C:\Libraries\SFML-2.5.1\include".
Title: Re: Cannot open include file: 'SFML/Graphics.hpp': No such file or directory...
Post by: KeegPNW on October 05, 2021, 11:59:30 pm
In the first screenshot you have "C:\SFML-2.5.1\include" for "Additional Include Directories". This should probably be "C:\Libraries\SFML-2.5.1\include".

Ah. thanks for pointing that out! I changed the location of my SFML folder multiple times while experimenting with the issue, and I guess I forgot to change it in Visual Studio the last time. Unfortunately this is not the cause of the issue, but at least I'm not thrown off track now... I've updated the link to a screenshot showing the proper directory.
Title: Re: Cannot open include file: 'SFML/Graphics.hpp': No such file or directory...
Post by: kojack on October 06, 2021, 04:09:11 am
What does the contents of C:\Libraries\SFML-2.5.1\include look like?
The error is saying it can't find SFML/Graphics.hpp, so that means it would be looking for C:\Libraries\SFML-2.5.1\include\SFML\Graphics.hpp
Does that file exist in that exact location?

At a guess, maybe your headers are directly in C:\Libraries\SFML-2.5.1\include and not in C:\Libraries\SFML-2.5.1\include\SFML
Title: Re: Cannot open include file: 'SFML/Graphics.hpp': No such file or directory...
Post by: KeegPNW on October 06, 2021, 04:24:36 am
What does the contents of C:\Libraries\SFML-2.5.1\include look like?
The error is saying it can't find SFML/Graphics.hpp, so that means it would be looking for C:\Libraries\SFML-2.5.1\include\SFML\Graphics.hpp
Does that file exist in that exact location?

At a guess, maybe your headers are directly in C:\Libraries\SFML-2.5.1\include and not in C:\Libraries\SFML-2.5.1\include\SFML

Nop, files are in "include\SFML"...
https://ibb.co/pxwW4Sg
Title: Re: Cannot open include file: 'SFML/Graphics.hpp': No such file or directory...
Post by: eXpl0it3r on October 10, 2021, 06:05:49 pm
Configuration looks correct to me, are you also building the right project and/or the right architecture (Win32 vs x64)?
Title: Re: Cannot open include file: 'SFML/Graphics.hpp': No such file or directory...
Post by: KeegPNW on October 11, 2021, 04:09:03 am
Configuration looks correct to me, are you also building the right project and/or the right architecture (Win32 vs x64)?

Target is currently set to 64, but I've tried 32 just to make sure. I'm pretty sure I'm building the right project, and the errors appear in the editor before any of that if it means anything.