going from console to SFML for the first time (in linux)

i am not really great at working with the terminal in linux, but anyways i downloaded SFML 1.6 for linux
http://www.sfml-dev.org/tutorials/1.6/start-linux.php

under installing SFML is says "Once you have downloaded and extracted the files to your hard drive, you must install the SFML headers and library files to the appropriate location. To do so, you just have to go to the SFML-x.y directory and type "sudo make install".

id dont know what it means by going to the SFML-x.y directory?
terminal in linux
1
2
3
4
5
6
7
8
9
10
11
12
13
14
metulburr@metulburrPC ~/SFML-1.6 $ sudo make install
[sudo] password for metulburr: 
make[1]: Entering directory `/home/metulburr/SFML-1.6/src/SFML'
make[2]: Entering directory `/home/metulburr/SFML-1.6/src/SFML/System'
make[2]: Leaving directory `/home/metulburr/SFML-1.6/src/SFML/System'
make[2]: Entering directory `/home/metulburr/SFML-1.6/src/SFML/Window'
make[2]: Leaving directory `/home/metulburr/SFML-1.6/src/SFML/Window'
make[2]: Entering directory `/home/metulburr/SFML-1.6/src/SFML/Network'
make[2]: Leaving directory `/home/metulburr/SFML-1.6/src/SFML/Network'
make[2]: Entering directory `/home/metulburr/SFML-1.6/src/SFML/Graphics'
make[2]: Leaving directory `/home/metulburr/SFML-1.6/src/SFML/Graphics'
make[2]: Entering directory `/home/metulburr/SFML-1.6/src/SFML/Audio'
make[2]: Leaving directory `/home/metulburr/SFML-1.6/src/SFML/Audio'
make[1]: Leaving directory `/home/metulburr/SFML-1.6/src/SFML'


did i do this right?
Whenever possible, you should use the package manager to install libraries. Only build them yourself if there's no recent enough version in the repos or if you intend to modify them.
In Debian/Ubuntu/Mint, the package name of the SFML development kit is libsfml-dev.

id dont know what it means by going to the SFML-x.y directory?
You change the current directory with the command cd (in a terminal).
ok so i went to package manager and searched and installed libsfml-dev, what did i just do??? installed sfml headers or what? what exactly is the developmental kit?
and how would i get the libraries available in Code::Blocks
Last edited on
When you install the development variant of a library (those that end in -dev), the following is generally installed:
1. the library itself (i.e. the shared libraries).
2. the header files.
3. the static variants of the libraries (if any).

In the package manager, you can also right-click an already installed package and check which files were installed under Properties/Installed files.

and how would i get the libraries available in Code::Blocks

You just need to link the libraries you need (e.g. sfml-graphics and sfml-window), by adding them to "Link libraries" in Project/Build options/Linker settings.
Last edited on
thanks Athar,

that was the first time i ever even went into package manager, im use to going in software manager
im going into unfamiliar territory (without the console) including these files, that file, and such, im just use to using the standard.

wouldn't I want to link all the libraries that i just downloaded?
Last edited on
that was the first time i ever even went into package manager, im use to going in software manager

It's the same thing, really. They're just two different interfaces for the package management system. Use whatever you prefer.

im going into unfamiliar territory (without the console) including these files, that file, and such, im just use to using the standard.

You lost me there.

wouldn't I want to link all the libraries that i just downloaded?

Only if you need them all. If you don't use any audio or network capabilities, you won't need those, for instance.
Last edited on
when i go into code blocks > linker settings and click add under link libraries: it gives a little window to go to the file ... i then go to usr/include/SFML and click on the (windows) for example, and it only gives me the option to open it (if i do i just get an empty looking file) and at that point i am stuck and unsure of what to do?

when i go there not via code blocks i can see all the .hpp files in Window though ???
Last edited on
when i go into code blocks > linker settings and click add under link libraries: it gives a little window to go to the file ... i then go to usr/include/SFML and click on the (windows) for example, and it only gives me the option to open it (if i do i just get an empty looking file) and at that point i am stuck and unsure of what to do?

No, not like that. Just type e.g. sfml-graphics into the "Add library" text field (separate them with a semicolon if you want to add several libraries).

/usr/include only contains header files anyway. You don't need to link against those (nor is such a thing possible), only the libraries.
like
sfml-graphics; sfml-window; sfml-system

after that i tried to run this test program to make sure it worked and i get an error that GL/gl.h no such file or directory

the tester program is

main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <SFML/Graphics.hpp>

using namespace sf;

int main()
{
// Create the main rendering window
    sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");

    // Start game loop
    while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();
        }

        // Clear the screen (fill it with black color)
        App.Clear();

        // Display window contents on screen
        App.Display();
    }

    return EXIT_SUCCESS;
}


OpenGL.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef SFML_OPENGL_HPP
#define SFML_OPENGL_HPP


////////////////////////////////////////////////////////////
/// Headers
////////////////////////////////////////////////////////////
#include <SFML/Config.hpp>


////////////////////////////////////////////////////////////
/// This file just includes the OpenGL (GL and GLU) headers,
/// which have actually different paths on each system
////////////////////////////////////////////////////////////
#if defined(SFML_SYSTEM_WINDOWS)

    #include <windows.h>
    #include <GL/gl.h>
    #include <GL/glu.h>

#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD)

    #include <GL/gl.h>
    #include <GL/glu.h>

#elif defined(SFML_SYSTEM_MACOS)

    #include <OpenGL/gl.h>
    #include <OpenGL/glu.h>

#endif


#endif // SFML_OPENGL_HPP
Last edited on
Looks like you need the OpenGL headers as well. The package freeglut3-dev takes care of that.
after downloading that, im not sure what to type in with the other files?

files installed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/.
/usr
/usr/include
/usr/include/GL
/usr/include/GL/freeglut.h
/usr/include/GL/freeglut_ext.h
/usr/include/GL/freeglut_std.h
/usr/include/GL/glut.h
/usr/lib
/usr/lib/libglut.a
/usr/lib/libglut.so
/usr/share
/usr/share/doc
/usr/share/doc/freeglut3-dev
/usr/share/doc/freeglut3-dev/changelog.Debian.gz
/usr/share/doc/freeglut3-dev/copyright
/usr/share/doc/freeglut3-dev/download.html
/usr/share/doc/freeglut3-dev/freeglut.html
/usr/share/doc/freeglut3-dev/freeglut_logo.png
/usr/share/doc/freeglut3-dev/freeglut_user_interface.html
/usr/share/doc/freeglut3-dev/index.html
/usr/share/doc/freeglut3-dev/ogl_sm.png
/usr/share/doc/freeglut3-dev/progress.html
/usr/share/doc/freeglut3-dev/structure.html
Last edited on
You were just missing the headers, so you don't need to do anything else.
Just compile your program.
ok first of all thank you Athar,

second, after clicking SFML project and compiling the same code i get both a console and a window that open up, is that suppose to happen? and by killing the console the window also closes?

thirdly, i have no idea what to do... in console i know why this is there and that is here, but i look at some of this example code that brings up a window and get confused?
Last edited on
Yes, that's normal. The console window allows you to see the console output of your application, if there is any. It won't show up when you start the program outside of the IDE.
If you don't want the console window, go to Project/Properties/Build targets and change the types of your build targets from "Console application" to "GUI application".

thirdly, i have no idea what to do... in console i know why this is there and that is here, but i look at some of this example code that brings up a window and get confused?

Well, read the SFML tutorial. I assume all of that will be explained.
Last edited on
again thank you,

so i should be mostly set up to start learning SFML then , im hoping?
Yes, if that SFML example compiled fine, then it's likely that more complex SFML programs are going to compile as well.
i like the console coming up giving info

im not sure if it did what it was suppose to do, but a console came up, and a window with a microsoft looking symbol in the upper left corner was there with a pitch black screen, and thats it lol
do i have to that for all my IDE;s such as netbeans, etc.
Yes, unless you use makefiles. Although I see no point in using more than one IDE for the same language (except those that have a specific application area, such as Qt Creator).

im not sure if it did what it was suppose to do, but a console came up, and a window with a microsoft looking symbol in the upper left corner was there with a pitch black screen, and thats it lol

Of course. The application doesn't do anything more than that, so it's to be expected.
Last edited on
Topic archived. No new replies allowed.