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

Author Topic: Error compilation programm с++ SFML.  (Read 417 times)

0 Members and 1 Guest are viewing this topic.

ArtyomTank

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Error compilation programm с++ SFML.
« on: April 10, 2019, 11:52:54 am »
compilator throw error
Error:

In file included from E:\SFMLProjects\Test\testSFML.cpp:1:
E:/libs/SFMLnotBuild/SFML-2.5.1/include/SFML/System.hpp:32:10: fatal error: SFML/Config.hpp: No such
file or directory
#include <SFML/Config.hpp>
^~~~~~~~~~~~~~~~~
compilation terminated.



I input this:

E:\MinGW\mingw32\bin>
g++ -static -o -LE:\libs\SFMLnotBuild\SFML-2.5.1\include -LE:\libs\SFMLnotBuild\SFML-2.5.1\lib -LE:\libs\SFMLnotBuild\SFML-2.5.1\bin -lsfml-window -lsfml-graphics -lsfml-system -static -libcc -static -libstdc++ E:\SFMLProjects\Test\testSFML.cpp




this code:

#include <E:/libs/SFMLnotBuild/SFML-2.5.1/include/SFML/System.hpp>
#include <E:/libs/SFMLnotBuild/SFML-2.5.1/include/SFML/Window.hpp>
#include <E:/libs/SFMLnotBuild/SFML-2.5.1/include/SFML/Graphics.hpp>
int main(){
    sf::RenderWindow window(sf::VideoMode({800, 600}),"Test");
   
    window.clear();
   
    sf::CircleShape circle(40);
    circle.setPosition({200,120});
    circle.setFillColor(sf::Color(0xFF,0x0,0x0));
    window.draw(circle);
   
    window.display();
   
    sf::sleep(sf::seconds(20));
}

Hapax

  • Hero Member
  • *****
  • Posts: 2706
  • My number of posts is shown in hexadecimal.
    • View Profile
Re: Error compilation programm с++ SFML.
« Reply #1 on: April 10, 2019, 12:21:46 pm »
Remember you need to use the static libraries if you're building statically.
Selba Ward - SFML drawables
Kairos - Timing Library
Rectangular Boundary Collision - Rectangular SAT Collision

@Hapaxiation - Hapaxia on Twitter

ArtyomTank

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 9205
    • View Profile
    • development blog
    • Email
Re: Error compilation programm с++ SFML.
« Reply #3 on: April 11, 2019, 10:19:56 am »
You used twice -L for the include and lib directory. You need to use -I to tell the compiler where to find the headers. And your .cpp file needs to be listed before you're linking the libraries, because of the "depends on" rule of thumb.
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/

 

anything