LINK2001 error for SFML

I'm trying to learn SFML and so I downloaded the headers and libraries and I'm going through the tutorials with Visual Studio C++ 2010.

When I try to compile my first program to display a cube, I get the following:

error LNK2001: unresolved external symbol _gluPerspective@32


I do use gluPerspective(90.f, 1.f, 1.f, 500.f); in the code. If I comment this out then I can compile, but I don't get what I wanted to get.

Now I'm trying to find where I went wrong. I downloaded the full SFML DPK package and stuck the whole thing in my visual studio ./include/ folder. I've added the lib files to my libraries folder.

I don't really know much about Link errors since I normally don't create my own projects at work so any input would be appreciated.
Last edited on
Update:

I've tried adding my own APIENTRY to replace gluPerspective()

I added:
1
2
3
4
5
void APIENTRY gluPerspect (
    GLdouble fovy, 
    GLdouble aspect, 
    GLdouble zNear, 
    GLdouble zFar);


and changed gluPerspective in my code to gluPerspect. I still get a link error. This doesn't make any sense to me as gluPerspect is a brand new entry, not something that should have been part of something else! The only thing that I can think now is that APIENTRY (which is defined as #define APIENTRY WINAPI ) has a problem. I don't do much linking with DLLs so perhaps I need to include something in order to communicate with WINAPI.

My only inlcudes right now are:
1
2
#include <SFML/Window.hpp>
#include <stdio.h> 
Last edited on
Okay so I've removed the original gluPerspective, got rid of all of the defines and now I just have this in my code:

1
2
3
4
5
void __stdcall gluPerspect (
    double fovy, 
    double aspect, 
    double zNear, 
    double zFar);


I refer to gluPerspect and get the link error. Therefore there must be an essential windows library file or dll that is somehow missing. Does anybody know what it is?

I am using a clean install of MS Visual Studio 2010 and I've downloaded a new SFML. Before tonight I have never had a compiler on this PC (at least the Windows portion of it).

Last edited on
Problem solved (well mostley)

For anyone that may have the same problem, I was missing glut32.lib.

A complete development installation of OpenGL will look like the following:

In Location: [compiler]\include\gl
gl.h
glut.h
glu.h

In Location: [compiler]\lib
Opengl32.lib
glut32.lib
glu32.lib

In Location: [system] (or somewhere pointed by the PATH environment variable)
Opengl32.dll
glut32.dll
glu32.dll

I still have a runtime error when I try and use the sf:: namespace but that is an issue for another forum.
Topic archived. No new replies allowed.