So I'm trying to compile on windows using g++ and I get a few errors, not sure what I'm doing wrong.
C:\Users\Lamonte\Documents\Project\C++>g++ main.cpp -Ic:\SFML-2.0\include
In file included from c:\SFML-2.0\include\SFML/System.hpp:34,
from c:\SFML-2.0\include\SFML/Window.hpp:32,
from c:\SFML-2.0\include\SFML/Graphics.hpp:32,
from main.cpp:1:
c:\SFML-2.0\include\SFML/System/Err.hpp:32: ostream: No such file or directory
In file included from c:\SFML-2.0\include\SFML/System.hpp:39,
from c:\SFML-2.0\include\SFML/Window.hpp:32,
from c:\SFML-2.0\include\SFML/Graphics.hpp:32,
from main.cpp:1:
c:\SFML-2.0\include\SFML/System/String.hpp:32: locale: No such file or directory
In file included from c:\SFML-2.0\include\SFML/System.hpp:43,
from c:\SFML-2.0\include\SFML/Window.hpp:32,
from c:\SFML-2.0\include\SFML/Graphics.hpp:32,
from main.cpp:1:
c:\SFML-2.0\include\SFML/System/Utf.hpp:33: locale: No such file or directory
Source: 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;
}
So i've reinstalled MingW on windows (http://sourceforge.net/projects/mingw/?source=dlp)
Source: main.cpp
#include <SFML/Window.hpp>
int main()
{
sf::Window window(sf::VideoMode(800, 600), "My window");
// run the program as long as the window is open
while (window.isOpen())
{
// check all the window's events that were triggered since the last iteration of the loop
sf::Event event;
while (window.pollEvent(event))
{
// "close requested" event: we close the window
if (event.type == sf::Event::Closed)
window.close();
}
}
return 0;
}
Ran: g++ -c main.cpp -Ic:\SFML-2.0\include -> main.o file was created.
Now when I go to do: g++ main.o -o sfml-app -Lc:\SFML-2.0\lib -lsfml-window -lsfml-system
I get a weird error:
C:\Users\Lamonte\Documents\Project\C++>g++ main.o -o sfml-app -Lc:\SFML-2.0\lib
-lsfml-window -lsfml-system
main.o:main.cpp:(.text+0xd1): undefined reference to `_imp___ZN2sf6StringC1EPKcR
KSt6locale'
main.o:main.cpp:(.text+0xf7): undefined reference to `_imp___ZN2sf9VideoModeC1Ej
jj'
main.o:main.cpp:(.text+0x132): undefined reference to `_imp___ZN2sf6WindowC1ENS_
9VideoModeERKNS_6StringEjRKNS_15ContextSettingsE'
main.o:main.cpp:(.text+0x162): undefined reference to `_imp___ZN2sf6Window5close
Ev'
main.o:main.cpp:(.text+0x178): undefined reference to `_imp___ZN2sf6Window9pollE
ventERNS_5EventE'
main.o:main.cpp:(.text+0x18a): undefined reference to `_imp___ZNK2sf6Window6isOp
enEv'
main.o:main.cpp:(.text+0x1a1): undefined reference to `_imp___ZN2sf6WindowD1Ev'
main.o:main.cpp:(.text+0x1cf): undefined reference to `_imp___ZN2sf6WindowD1Ev'
main.o:main.cpp:(.text+0x1f9): undefined reference to `_imp___ZN2sf6WindowD1Ev'
collect2: ld returned 1 exit status