SFML community forums

Help => Window => Topic started by: Xylankant on June 26, 2008, 08:33:06 pm

Title: [Solved] undefined reference to `_gluPerspective@32'
Post by: Xylankant on June 26, 2008, 08:33:06 pm
Hi folks,

I just stumbled upon SFML some days ago, when figuring out some ways of programming some game or sth., and I apologize my first post here is a request for help...

Right now, I'm working myself into both, SFML and C++ (so far, I'm used to Java ;) ), and of course I'm checking out your tutorials.

However, I came across a problem I can't figure out myself when doing the OpenGL-tut (not knowing if I ever want to use OpenGL, but I'll take what I can get ^^ )
I'm not sure whether this is the right sub-forum for OpenGL related topics, but as you are to inluce Window.hpp for OpenGL, I guess it is.

BTW, I'm using Windows XP, and for that Code::Blocks with mingw (so it's gcc for compiling, I think)

So far, my code looks like this (I'm sorry for doing comments in German, but they're useless at this moment, anyway):
Code: [Select]
#include <iostream>
#include <SFML/Window.hpp>

using namespace std;

int main()
    /*Für mehr Kontrolle über OpenGL-Settings:

    sf::WindowSettings Settings;
    Settings.DepthBits         = 24; // Request a 24 bits depth buffer
    Settings.StencilBits       = 8;  // Request a 8 bits stencil buffer
    Settings.AntialiasingLevel = 2;  // Request 2 levels of antialiasing
    sf::Window App(sf::VideoMode(800, 600, 32), "OpenGL Test" /* , sf::Style::Close, Settings */);


    /* Tatsächliche OpenGL-Settings bekommen:

    sf::WindowSettings Settings = App.GetSettings();

    //Color- und DepthClear Werte
    glClearColor(0.f, 0.f, 0.f, 0.f);

    //Z-Buffer mit Read-Write-Rechten

    gluPerspective(90.f, 1.f, 1.f, 500.f);


        sf::Event Event;

        if(Event.Type == sf::Event::Closed || ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))){
        if(Event.Type == sf::Event::Resized){
            glViewport(0, 0, Event.Size.Width, Event.Size.Height);


Ok, so, when compiling this, I'll get an error saying
Code: [Select]
E:/Dateien/CodeBlocks Workspace/OpenGL/main.cpp:35: undefined reference to `_gluPerspective@32'

As stated above, I just can't do anything with it, as it should be referenced (well, I think so...) by including SFML/Window.hpp (or not?)

I've read another thread, where someone said you should include SFML_GLU_HEADER , however, this just gives me "Directory not found" in line 3 ^^

Well, that's that, I really hope someone out here can help me.

P.S.: Please forgive possible mistakes, I'm only a German ;)
Title: [Solved] undefined reference to `_gluPerspective@32'
Post by: SirJulio on June 26, 2008, 08:52:32 pm

if you want to use opengl or glu functions, you must link with Opengl and Glu library (opengl32 and glu32 with mingw). =)
Title: [Solved] undefined reference to `_gluPerspective@32'
Post by: workmad3 on June 26, 2008, 08:52:52 pm
Are you using SFML 1.2 or SFML 1.3? With  1.2, you need to include the headers yourself, and with 1.3 you just need Window.hpp.
Title: [Solved] undefined reference to `_gluPerspective@32'
Post by: Xylankant on June 26, 2008, 08:57:52 pm
Sry, I forgot: I'm using SFML release 1.3

Concerning missing libraries, are they supposed to ship with SFML or where can I find them? (gosh, I'm such a noob...never handled OpenGL so far ^^ )

edit: omfg, thank you!
I looked for opengl32 and glu32 in SFML's include, not in Code::Block's mingw include directory

it no works! thanks a lot!