the last of the sfml issues

closed account (Dy7SLyTq)
thanks to everyone whos helped me install sfml, and now theres on last issue. I am running ubuntu 13.04 64 bit with g++ installed. i was getting these same issues on natty, but someone recommended i upgrade, so i did to my current os.
my code is:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#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();
    }
}


and i am compiling with g++ -c main.cpp -ISFML-2.1/include, which works fine, but then i use this to complete the compilation: g++ main.o -o sfml-app -LSFML-2.1/lib -lsfml-graphics -lsfml-window -lsfml-system which throws the errors:
/usr/bin/ld: warning: libGLEW.so.1.5, needed by SFML-2.1/lib/libsfml-graphics.so, not found (try using -rpath or -rpath-link)
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__glewUniform1fARB'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__GLEW_ARB_shader_objects'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__glewGetObjectParameterivARB'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__GLEW_ARB_vertex_shader'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__glewFramebufferTexture2DEXT'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__glewUniformMatrix4fvARB'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__glewGenFramebuffersEXT'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__glewUniform3fARB'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__glewRenderbufferStorageEXT'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__GLEW_ARB_fragment_shader'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__glewActiveTextureARB'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__glewShaderSourceARB'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `glewInit'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__glewBindFramebufferEXT'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__glewFramebufferRenderbufferEXT'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__glewLinkProgramARB'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__glewUseProgramObjectARB'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__glewBlendFuncSeparateEXT'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__glewGenRenderbuffersEXT'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__glewUniform2fARB'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__glewUniform4fARB'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__glewCreateProgramObjectARB'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `glewGetErrorString'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__glewCompileShaderARB'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__glewDeleteRenderbuffersEXT'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__glewDeleteObjectARB'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__glewGetUniformLocationARB'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__glewGetInfoLogARB'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__GLEW_EXT_blend_func_separate'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__glewDeleteFramebuffersEXT'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__glewCheckFramebufferStatusEXT'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__glewUniform1iARB'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__GLEW_ARB_texture_non_power_of_two'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__GLEW_ARB_shading_language_100'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__glewCreateShaderObjectARB'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__glewBindRenderbufferEXT'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__GLEW_EXT_framebuffer_object'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__glewAttachObjectARB'
SFML-2.1/lib/libsfml-graphics.so: undefined reference to `__glewGetHandleARB'
collect2: error: ld returned 1 exit status


one would think to resolve this you would need to sudo apt-get install libGLEW1.5, but it says that its already up to date. i have also run sudo apt-get update.
I'm still going to recommend building from source, its actually very easy.

Edit: This page has a list of dependencies for building http://onlyakiss.net/2013/04/how-to-install-sfml-2-0-into-ubuntu-12-04/
Last edited on
closed account (Dy7SLyTq)
alright ill try it.
closed account (Dy7SLyTq)
that tutorial was great thank you. the only problem i have now is i got these errors from this code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#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;
}


main.o: In function `main':
main.cpp:(.text+0xf7): undefined reference to `sf::String::String(char const*, std::locale const&)'
main.cpp:(.text+0x148): undefined reference to `sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&)'
main.cpp:(.text+0x182): undefined reference to `sf::CircleShape::CircleShape(float, unsigned int)'
main.cpp:(.text+0x196): undefined reference to `sf::Shape::setFillColor(sf::Color const&)'
main.cpp:(.text+0x1b4): undefined reference to `sf::Window::close()'
main.cpp:(.text+0x1cd): undefined reference to `sf::Window::pollEvent(sf::Event&)'
main.cpp:(.text+0x212): undefined reference to `sf::RenderTarget::clear(sf::Color const&)'
main.cpp:(.text+0x229): undefined reference to `sf::RenderStates::Default'
main.cpp:(.text+0x234): undefined reference to `sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&)'
main.cpp:(.text+0x243): undefined reference to `sf::Window::display()'
main.cpp:(.text+0x252): undefined reference to `sf::Window::isOpen() const'
main.o: In function `sf::CircleShape::~CircleShape()':
main.cpp:(.text._ZN2sf11CircleShapeD2Ev[_ZN2sf11CircleShapeD5Ev]+0x13): undefined reference to `vtable for sf::CircleShape'
main.cpp:(.text._ZN2sf11CircleShapeD2Ev[_ZN2sf11CircleShapeD5Ev]+0x1f): undefined reference to `vtable for sf::CircleShape'
collect2: error: ld returned 1 exit status

Last edited on
How are you linking?
closed account (Dy7SLyTq)
g++ -c main.cpp
g++ main.o -o sfml-app -lsfml-graphics -lsfml-window -lsfml-system

the second one throws the errors
Try linking system before the others.
closed account (Dy7SLyTq)
alright ill try that. im on my windows machine right now but ill see if that works when i boot back into linux

edit: didnt work. same errors
Last edited on
Are you compiling in debug mode? You might need to link the debug libs instead (I think they have a trailing d or something on them).
What is the output from
 ld -lsfml-system -lsfml-graphics -lsfml-window
and
ls /usr/local/lib/libsfml-*

closed account (Dy7SLyTq)
ummm i actually deleted it to start over, i realized that i might have two versions so i got rid of all it and im starting again. ill see what happens afterwards. thanks for the help guys
Topic archived. No new replies allowed.