Adding SFML library Geany

Aug 18, 2014 at 3:38pm
Hello

Well, I'm using Geany as me IDE and I really like it.
But I've got a problem with binding the SFML library to it.

I know it must be done by changing 'build' settings in 'set build commands'. But what do I need to type there?
Until now no one was able to really 100% help me, I asked several forums.

Thanks for reading,
Niely
Aug 18, 2014 at 7:06pm
Try adding -lsfml-graphics -lsfml-window -lsfml-system ... and so on ... at the end of the build command.
Aug 18, 2014 at 7:52pm
It doesn't give an error and just compiles (I don't think it builds).
But this is what the terminal gives:
./geany_run_script.sh: 5: ./geany_run_script.sh: ./test: not found



What I have as build setting:
g++ -Wall -c "%f" -L "/home/Name/SFML" -lsfml-graphics -lsfml-window -lsfml-system

(It's a simple code to draw a circle).
Last edited on Aug 18, 2014 at 7:52pm
Aug 19, 2014 at 6:26am
Yeah that looks like a compile command. Are you sure you used/edit the right one? The build command is what you get when pressing F9 (by default). A build command should probably look something like this:

g++ -Wall -o "%e" "%f" -L "/home/Name/SFML" -lsfml-graphics -lsfml-window -lsfml-system

Note that that will only work for programs containing one source (.cpp) file.
Aug 19, 2014 at 9:29pm
Thanks a lot!
It compiles great now, but when I try to run this code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <iostream>
#include <SFML/Graphics.hpp>

using namespace std;
int main() {
cout<<"Test"<<endl;
sf::CircleShape circle;
circle.setRadius(150);
circle.setOutlineColor(sf::Color::Red);
circle.setOutlineThickness(5);
circle.setPosition(10, 20);
window.draw(circle);
}

It says:
Window was not declared in this scope.

How do I fix that?
Aug 19, 2014 at 9:43pm
I don't see window declared anywhere. You need something like sf::Window window;
Aug 19, 2014 at 9:51pm
Error: Window has no member named draw.
I think I'm getting close. :)
Aug 19, 2014 at 9:57pm
It doesn't look like sf::Window has a draw function.
http://www.sfml-dev.org/documentation/2.1/classsf_1_1Window.php

Try sf::RenderWindow instead.
http://www.sfml-dev.org/documentation/2.1/classsf_1_1RenderWindow.php

 
sf::RenderWindow window;
Last edited on Aug 19, 2014 at 9:58pm
Aug 19, 2014 at 10:05pm
It compiles without problems/errors. But still no circle. :)
Is it maybe because of my Linux terminal?
Aug 19, 2014 at 10:10pm
You need to have a loop that renders your window and other stuff. Go check the SFML tutorials for details.
Topic archived. No new replies allowed.