I work on ubuntu 14.04LTS. In the folder where GUI_test.cpp itself is, there is an SFML folder, all hpp's in it. So: I specify #include </SFML/Graphics.hpp> , and in response, the compiler writes:

g++ -Wall -o "GUI_test" "GUI_test.cpp" (в каталоге: /home/tms5978/test_c++/gui) GUI_test.cpp:1:30: fatal error: /SFML/Graphics.hpp: Нет такого файла или каталога #include </SFML/Graphics.hpp> ^ compilation terminated. Сборка завершилась с ошибкой.

Although all the files are there.

  • one
    And why do you start the way with / ? Do you really have an SFML directory in the root? - VladD
  • 2
    You will not believe it, but in Nix, if the path starts with "/", this is the absolute path. - Vladimir Martyanov

1 answer 1

As already indicated in the comments to the question: / sets the root directory of the file system. If you need to refer to the current directory, it is enough to remove / or you can add in front of it . .

Another point is that to connect header files that are not located in predefined paths, you should use an entry with double quotes, rather than triangular brackets. Those. correct to write like this:

 #include "SFML/Graphics.hpp" 

Or, enter the path where the SFML folder is located in the list of predefined paths (you can use the compiler -I to do this) and use an entry with triangular brackets:

 #include <SFML/Graphics.hpp> 

You can read about the differences between "" and <> in another topic .