I wrote this as a batch file:
g++ main.cpp -IC:\SFML-2.5.1\include\SFML\Graphics.hpp -o hero.exe resources\hero.res
and tried to to compile the following code(gotten from SFML website):
#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;
}
It returns the error:
C:\Users\ezj21\OneDrive\Desktop\Utilities\Coding\LearningC++>g++ main.cpp -IC:\SFML-2.5.1\include\SFML\Graphics.hpp -o hero.exe resources\hero.res
cc1plus.exe: warning: C:\SFML-2.5.1\include\SFML\Graphics.hpp: not a directory
main.cpp:1:10: fatal error: SFML/Graphics.hpp: No such file or directory
#include <SFML/Graphics.hpp>
^~~~~~~~~~~~~~~~~~~
compilation terminated.
Am I doing something wrong?
Now it gives me a long list of undefined references, but I got the code from the SFML Page:
https://www.sfml-dev.org/tutorials/2.5/start-vc.php @bottom
C:\Users\ezj21\AppData\Local\Temp\cc861KBj.o:main.cpp:(.text+0x83): undefined reference to `__imp__ZN2sf6StringC1EPKcRKSt6locale'
C:\Users\ezj21\AppData\Local\Temp\cc861KBj.o:main.cpp:(.text+0xa7): undefined reference to `__imp__ZN2sf9VideoModeC1Ejjj'
C:\Users\ezj21\AppData\Local\Temp\cc861KBj.o:main.cpp:(.text+0xeb): undefined reference to `__imp__ZN2sf12RenderWindowC1ENS_9VideoModeERKNS_6StringEjRKNS_15ContextSettingsE'
C:\Users\ezj21\AppData\Local\Temp\cc861KBj.o:main.cpp:(.text+0x127): undefined reference to `__imp__ZN2sf11CircleShapeC1Efy'
C:\Users\ezj21\AppData\Local\Temp\cc861KBj.o:main.cpp:(.text+0x130): undefined reference to `__imp__ZN2sf5Color5GreenE'
C:\Users\ezj21\AppData\Local\Temp\cc861KBj.o:main.cpp:(.text+0x13e): undefined reference to `__imp__ZN2sf5Shape12setFillColorERKNS_5ColorE'
C:\Users\ezj21\AppData\Local\Temp\cc861KBj.o:main.cpp:(.text+0x151): undefined reference to `__imp__ZNK2sf6Window6isOpenEv'
C:\Users\ezj21\AppData\Local\Temp\cc861KBj.o:main.cpp:(.text+0x170): undefined reference to `__imp__ZN2sf6Window9pollEventERNS_5EventE'
C:\Users\ezj21\AppData\Local\Temp\cc861KBj.o:main.cpp:(.text+0x18e): undefined reference to `__imp__ZN2sf6Window5closeEv'
C:\Users\ezj21\AppData\Local\Temp\cc861KBj.o:main.cpp:(.text+0x1bc): undefined reference to `__imp__ZN2sf5ColorC1Ehhhh'
C:\Users\ezj21\AppData\Local\Temp\cc861KBj.o:main.cpp:(.text+0x1da): undefined reference to `__imp__ZN2sf12RenderTarget5clearERKNS_5ColorE'
C:\Users\ezj21\AppData\Local\Temp\cc861KBj.o:main.cpp:(.text+0x1e3): undefined reference to `__imp__ZN2sf12RenderStates7DefaultE'
C:\Users\ezj21\AppData\Local\Temp\cc861KBj.o:main.cpp:(.text+0x1fc): undefined reference to `__imp__ZN2sf12RenderTarget4drawERKNS_8DrawableERKNS_12RenderStatesE'
C:\Users\ezj21\AppData\Local\Temp\cc861KBj.o:main.cpp:(.text+0x20f): undefined reference to `__imp__ZN2sf6Window7displayEv'
C:\Users\ezj21\AppData\Local\Temp\cc861KBj.o:main.cpp:(.text+0x238): undefined reference to `__imp__ZN2sf12RenderWindowD1Ev'
C:\Users\ezj21\AppData\Local\Temp\cc861KBj.o:main.cpp:(.text+0x294): undefined reference to `__imp__ZN2sf12RenderWindowD1Ev'
C:\Users\ezj21\AppData\Local\Temp\cc861KBj.o:main.cpp:(.text$_ZN2sf11CircleShapeD1Ev[_ZN2sf11CircleShapeD1Ev]+0xf): undefined reference to `__imp__ZTVN2sf11CircleShapeE'
C:\Users\ezj21\AppData\Local\Temp\cc861KBj.o:main.cpp:(.text$_ZN2sf11CircleShapeD1Ev[_ZN2sf11CircleShapeD1Ev]+0x21): undefined reference to `__imp__ZTVN2sf11CircleShapeE'
C:\Users\ezj21\AppData\Local\Temp\cc861KBj.o:main.cpp:(.text$_ZN2sf11CircleShapeD1Ev[_ZN2sf11CircleShapeD1Ev]+0x3b): undefined reference to `__imp__ZN2sf5ShapeD2Ev'
collect2.exe: error: ld returned 1 exit status
I don't know why I'm having so much trouble