main.cpp:
#include "SFML\Graphics.hpp"
int main()
{
sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Green);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(shape);
window.display();
}
return 0;
}
enviroment variables:
PATH:
C:\msys64\mingw64\bin
C:\SFML-2.6.1\include
but it keeps saying to console:
main.cpp:1:10: fatal error: SFML/Graphics.hpp: No such file or directory
1 | #include "SFML/Graphics.hpp"
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
i just don't know what to do yet. I was trying to write path via "/" but it still doesn't work, though.
folders of C disk:
In your g++
command line, add the flag -I...
like this: g++ -I C:\SFML-2.6.1\include
, and try again. (It doesn't matter whether there is a space after -I
.) Alternatively, you may set the CPLUS_INCLUDE_PATH
environment value to C:\SFML-2.6.1\include
.
After it succeeds, you will likely get an error from the linker. To fix that, set a library path for linking. That may look something like g++ -L C:\SFML-2.6.1\lib
. Alternatively set the LIBRARY_PATH
environment variable to C:\SFML-2.6.1\lib
.