Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Cannot open include file: 'SFML/Graphics.hpp': No such file or directory...  (Read 2009 times)

0 Members and 1 Guest are viewing this topic.

KeegPNW

  • Newbie
  • *
  • Posts: 4
    • View Profile
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)!
« Last Edit: October 06, 2021, 12:05:47 am by KeegPNW »

texus

  • Sr. Member
  • ****
  • Posts: 486
    • View Profile
    • TGUI
    • Email
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".
TGUI: C++ SFML GUI

KeegPNW

  • Newbie
  • *
  • Posts: 4
    • View Profile
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.
« Last Edit: October 06, 2021, 12:02:06 am by KeegPNW »

kojack

  • Jr. Member
  • **
  • Posts: 86
    • View Profile
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

KeegPNW

  • Newbie
  • *
  • Posts: 4
    • View Profile
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

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 9984
    • View Profile
    • development blog
    • Email
Configuration looks correct to me, are you also building the right project and/or the right architecture (Win32 vs x64)?
Official FAQ: https://www.sfml-dev.org/faq.php
Nightly Builds: https://www.nightlybuilds.ch/
——————————————————————
Dev Blog: https://dev.my-gate.net/
Thor: http://www.bromeon.ch/libraries/thor/

KeegPNW

  • Newbie
  • *
  • Posts: 4
    • View Profile
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.

 

anything