Error Undefined Reference To Gluperspective
Contents |
Get Kubuntu Get Xubuntu Get Lubuntu Get UbuntuStudio Get Mythbuntu Get Edubuntu Get Ubuntu-GNOME Get UbuntuKylin Ubuntu Code of Conduct Ubuntu Wiki Community Wiki Other Support Launchpad Answers Ubuntu IRC Support undefined reference to gluperspective qt AskUbuntu Official Documentation User Documentation Social Media Facebook Twitter Useful Links Distrowatch Bugs: glfrustum Ubuntu PPAs: Ubuntu Web Upd8: Ubuntu OMG! Ubuntu Ubuntu Insights Planet Ubuntu Activity Page Please read before SSO login Advanced
Glut
Search Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk Undefined reference to gluPerspective Having an Issue With Posting ? Do you want to help us debug the posting issues
Opengl Tutorial
? < is the place to report it, thanks ! Page 1 of 2 12 Last Jump to page: Results 1 to 10 of 16 Thread: Undefined reference to gluPerspective Thread Tools Show Printable Version Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode August 24th, 2010 #1 FattyOwl View Profile View Forum Posts Private Message 5 Cups of Ubuntu Join Date Aug 2010 Beans 19 Undefined reference to gluPerspective I am trying to learn OpenGL using these tutorials: http://www.videotutorialsrock.com/op...inux/video.php They told me to download a source file and compile it. It should result in a spinning cube. However when I try to compile it it gives me the following error: Code: kobe@kobe-laptop:~/Tutorials/Cube$ make g++ -Wall -o cube main.cpp imageloader.cpp -lglut imageloader.cpp: In function ‘Image* loadBMP(const char*)’: imageloader.cpp:141: warning: suggest parentheses around ‘&&’ within ‘||’ /tmp/ccDxFyfp.o: In function `handleResize(int, int)': main.cpp:(.text+0x18b): undefined reference to `gluPerspective' collect2: ld returned 1 exit status make: *** [cube] Error 1 I have got all the header files installed. How do I solve this problem? Thanks in advance! Adv Reply August 24th, 2010 #2 ju2wheels View Profile View Forum Posts Private Message Dipped in Ubuntu Join Date Sep 2008 Location Windsor,CT Beans 538 DistroUbuntu 12.04 Precise Pangolin Re: Undefined reference to gluPerspective You need to install the "dev" version of the libraries you are linking against as well... freeglut3 and freeglut3-dev. Code: sudo apt-get install freeglut3 freeglut3-dev Last edited by ju2wheels; August 24th, 2010 at 04:43 AM. Operating Systems for Old PCs | Ubuntu Full Circle Magazine Adv Reply August 24th, 2010 #3 Zugzwang View Prof
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up C++ OpenGL: Calling gluPerspective throws an undefined reference error? up vote 2 down vote favorite I am using FreeGLUT to try and create my first cube https://ubuntuforums.org/showthread.php?t=1559654 in C++ with OpenGL. I have an issue that whenever I call "gluPerspective", the compiler throws this error: build/Debug/MinGW-Windows/main.o: In function `main': C:\Users\User\Dropbox\NetBeans Workspace\Testing/main.cpp:47: undefined reference to `gluPerspective@32' I have looked around to see if anyone has had this problem and found nothing. So, I think I am being oblivious to something yet again. Here is where I call the function: ...... glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45, 1.333, 1, 1000); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); ...... I include freeGLUT and everything http://stackoverflow.com/questions/14793454/c-opengl-calling-gluperspective-throws-an-undefined-reference-error else works except that line. I checked the documentation , and it seems as though I am using it correctly. I am at a loss. c++ opengl perspective freeglut glu share|improve this question asked Feb 10 '13 at 0:56 CoderTheTyler 421816 Before i answer the question you got: Why use the fixed function pipline? The FFP is deprecated. –Felix K. Feb 10 '13 at 1:04 I am just trying to get a basic working test down before jumping into shaders and whatnot. –CoderTheTyler Feb 10 '13 at 1:12 add a comment| 1 Answer 1 active oldest votes up vote 2 down vote gluPerspective was removed from GLU (the OpenGL helper library) at version 3.1. Are you compiling against the correct library that still has it defined? If not then you will need to write your own version and pass the matrix direct to OpenGL. OpenGL.org has the gluPerspective code on it's website (presented here for completeness): //matrix will receive the calculated perspective matrix. //You would have to upload to your shader // or use glLoadMatrixf if you aren't using shaders. void glhPerspectivef2(float *matrix, float fovyInDegrees, float aspectRatio, float znear, float zfar) { float ymax, xmax; float temp, temp2, temp3, temp4; ymax = znear * tanf(fovyInDegrees * M_PI / 360.0); //ymin = -ymax; //xmin = -ymax * aspectRatio; xmax = ymax * aspectRatio; glhFrustumf2(
dwende Member From: Israel Registered: 2008-12-04 Posts: 27 Problem compiling with glut - gluPerspective I am going through the https://bbs.archlinux.org/viewtopic.php?id=91281 opengl tutorials on http://www.videotutorialsrock.com/ and havea problem similar to that http://www.richelbilderbeek.nl/CppLinkErrorUndefinedReferenceToGluPerspective.htm mentioned in an old posting:http://bbs.archlinux.org/viewtopic.php? … 65#p709765I am having a similar compile problem with gluPerspective.Any ideas anyone? The error is:[dwende@AMD cube]$ makeg++ -Wall -o cube main.cpp imageloader.cpp -lglut -lGLimageloader.cpp: In function 'Image* loadBMP(const char*)':imageloader.cpp:141: warning: suggest parentheses around '&&' within undefined reference '||'/tmp/ccTcVEcJ.o: In function `handleResize(int, int)':main.cpp:(.text+0x183): undefined reference to `gluPerspective'collect2: ld returned 1 exit statusmake: *** [cube] Error 1[dwende@AMD cube]$I have freeglut installed as seen here:[dwende@AMD cube]$ pacman -Qi freeglutName : freeglutVersion : 2.6.0-1URL : http://freeglut.sourceforge.net/Licenses : undefined reference to MITGroups : NoneProvides : glutDepends On : libxxf86vm mesa libxiOptional Deps : NoneRequired By : gtkglarea jasper swftoolsConflicts With : glutReplaces : glutInstalled Size : 720.00 KPackager : Eric Belanger
undefined reference to 'gluPerspective'
:: error: collect2: ld returned 1 exit status
Cause IDE: Qt Creator 2.0.0 Project type: Qt4 Console Application Selected required modules: QtCore Compiler: G++ 4.4.1 The following source code was used: #include
int main()
{
gluPerspective (0,0,0,0);
}
The following project file was used: #-------------------------------------------------
#
# Project created by QtCreator 2010-09-13T09:39:02
#
#-------------------------------------------------
QT += core
QT -= gui
TARGET = MyTarget
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
Solution You need to link against the GLU library. Add the following line to your project file: LIBS += -L/usr/local/lib -lGLU
Note that the shown code will not give a correctly-running program, because it is too incomplete. Go back to Richel Bilderbeek's C++ page. Go back to Richel Bilderbeek's homepage.