Sign in to follow this  

gluPerspective() problem

This topic is 3494 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I get a linker error when i try to use the gluPerspective(), it says: [Linker error] undefined refference to gluPerspective@32, Id returned 1 exit status, [Build error] [program.exe] Error 1. I am using the Dev-C++ IDE. Should I just get a new compiler? Steve.

Share this post


Link to post
Share on other sites
The compiler has already run successfully, or else the linker wouldn't be called. Has you specified to link against the GLU library? Is the path to the library made known to the linker?

Share this post


Link to post
Share on other sites
I think it would be, it's the standard gl lib.
It only displays the error on a test run, checking the syntax shows no errors.
Is there an alternate to the Perspective command?


Share this post


Link to post
Share on other sites
I'm almost sure that you're not linking against glu32.lib... Keep in mind that compiling and linking are two different things. Simply said, the compiler checks your syntax and when that is done, the linker puts everything together so that an executable is generated.

An alternative for gluPerspective: http://glprogramming.com/dgs.php?dg=1

Share this post


Link to post
Share on other sites
Quote:
Original post by syi47805
I think it would be, it's the standard gl lib.
It only displays the error on a test run, checking the syntax shows no errors.
Is there an alternate to the Perspective command?


gluPerspective isn't a part of opengl32.lib , its in glu32.lib.

Edit: beaten by walter.

Share this post


Link to post
Share on other sites
That depends on your compiler :)

I'm only familiar with Visual Studio.

- Open the properties of your project.
- Click on the "Linker" node.
- Click on the "Input" sub node.
- Add "glu32.lib" at the "Additional Dependencies" option.

Good luck.

Share this post


Link to post
Share on other sites
Quote:
Original post by syi47805
Is there an alternate to the Perspective command?

Besides the fact that knowing how to link against libraries will be senseful anyway:

The routine behind gluPerspective is OpenGL's native glFrustum routine. You can use it directly or else by parameter substitution (see in the middle of this thread for a routine posted by lexs).

Share this post


Link to post
Share on other sites
Quote:
Original post by syi47805
Point well taken, obviously if I can't link a library I haven't learned enough to do graphics.

Oh well back to iostreams I suppose.

Libraries are not at all restricted to graphic APIs. Actually also iostream will need to link a library. The difference is that those library is already bound to the project by the IDE since you probably have picked something like "I will have a C++ project" when creating the project.

Share this post


Link to post
Share on other sites
If you are using Dev-C++ (which is an old, unmaintained IDE that you should get rid of in favour of VS2008 or Code::Blocks), chances are that you are using Mingw as your compiler. If so, somewhere under "linker options" in your project settings should be a field where you can add command line arguments. To link the glu library in your project, add the command -lglu.

Share this post


Link to post
Share on other sites

This topic is 3494 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this