LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-15-2004, 07:51 AM   #1
paulr1984
Member
 
Registered: Dec 2003
Posts: 75

Rep: Reputation: 15
help installing glut


Hi! I'm really desperate in getting a complete answer on this one. I'm trying to make a gui for my c application. It has to use mesa. After visiting a few websites, I realize that I need to use glut, which provides windowing functionality for mesa. Now, I have already installed all packages which I think are necessary.

These packages are found in the mandrake 9.1 distribution cds:

libMesaGL1-5.0-3mdk
libMesaGLU1-5.0-3mdk
libMesaGLU1-devel-5.0-3mdk
libMesaglut3-5.0-3mdk
libMesaglut3-devel-5.0-3mdk
Mesa-5.0-3mdk
Mesa-demos-5.0-3mdk

Here is a sample c application that uses glut:
Code:

Code:
#include <GL/glut.h>

int main( int argc, char** argv )
{
  glutInit( &argc, argv );
  glutInitDisplayMode( GLUT_RGB );

  glutInitWindowPosition( 0, 0 );
  glutInitWindowSize( 300, 300 );
  int myWindow = glutCreateWindow( "hello world!" );

  glutMainLoop();
  return 0;
}
compiling it with "gcc simpleGlut.c" outputs the ff errors:

undefined reference to glutInit
undefined reference to glutInitDisplayMode
undefined reference to glutInitWindowPosition
undefined reference to glutInitWindowSize
undefined reference to glutCreateWindow
undefined reference to glutCreateMainLoop

compiling it with "gcc simpleGlut.c" outputs:
cannot find lglut

I viewed the GL/glut.h file in the /usr/include directory. I saw that the function prototypes were there. I think there's something wrong with the library i'm compiling with.

is it really "gcc simpleGlut.c -lglut"? Or something else?
Do I need the opengl-devel package installed? I can't find it in the linux distribution cds.

Maybe you could give me a link to a good website on this topic? I got nothing from www.mesa3d.org.

I'm using mandrake 9.1.
Thanks for reading this long post.
 
Old 03-15-2004, 01:04 PM   #2
stirling
Member
 
Registered: Feb 2004
Distribution: LFS, Ubuntu
Posts: 52

Rep: Reputation: 16
gcc -I/usr/X11R6/include -lglut -o simpleGlut simpleGlut.c

-I (eye) says look for includes in this dir
-l (ell) says use this library
-o output binary name
 
Old 03-15-2004, 10:51 PM   #3
paulr1984
Member
 
Registered: Dec 2003
Posts: 75

Original Poster
Rep: Reputation: 15
hi! thanks for the quick reply. I tried compiling it with:

gcc -I/usr/X11R6/include -lglut -o simpleGlut simpleGlut.c

I still got undefined referece to (functionName) errors. I found out that there was a /user/X11R6/include/GL directory. So i tried:

gcc -I/usr/X11R6/include/GL -lglut -o simpleGlut simpleGlut.c

I still got the same errors.

How do I know if I have the libglut.a library? how do I know its the right one? I initially didn't have one even though I already installed the above mentioned packages. So, I downloaded one and placed it into the /usr/lib directory. My _simple_ code still doesn't compile.

Any ideas?
 
Old 03-15-2004, 11:53 PM   #4
Cerbere
Member
 
Registered: Dec 2002
Location: California
Distribution: Slackware & LFS
Posts: 799

Rep: Reputation: 33
I'll start out with a simple fix: Did you run /sbin/ldconfig after installing the libraries?

Then, a suggestion: You may want to check out freeglut.

Enjoy!
--- Cerbere
 
Old 03-16-2004, 03:04 AM   #5
paulr1984
Member
 
Registered: Dec 2003
Posts: 75

Original Poster
Rep: Reputation: 15
I ran the /sbin/ldconfig. Then, I tried compiling the code again. I still got the same undefined reference errors. I also installed freeglut. Here are the steps I took:

1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.

Running `configure' takes a while. While running, it prints some
messages telling which features it is checking for.

2. Type `make' to compile the package.

3. Type `make install' to install the programs and any data files and
documentation.

I also added /usr/local/lib (where libglut.a libglut.la libglut.so libglut.so.3 libglut.so.3.8.0 were) to the LD_LIBRARY_PATH and LD_RUN_PATH.

I compiled the program again with 'gcc simpleGlut.c -lglut'. I still got those errors.

What's wrong?

Last edited by paulr1984; 03-16-2004 at 03:30 AM.
 
Old 03-16-2004, 05:11 AM   #6
stirling
Member
 
Registered: Feb 2004
Distribution: LFS, Ubuntu
Posts: 52

Rep: Reputation: 16
try adding /usr/local/lib to /etc/ld.so.conf
run ldconfig
gcc -I/usr/X11R6/include -L/usr/local/lib -lglut -o simpleGlut simpleGlut.c

-L says look for libraries in dir, and should be put before the lib you're using

the undefined reference error usually means it just can't find the library.
you don't want to add the GL dir for the include in your compile line, because it's already specified in your source file as GL/glut.h (it would be looking for /usr/X11R6/include/GL/GL/glut.h)
 
Old 03-16-2004, 11:31 AM   #7
paulr1984
Member
 
Registered: Dec 2003
Posts: 75

Original Poster
Rep: Reputation: 15
Quote:
try adding /usr/local/lib to /etc/ld.so.conf
run ldconfig
gcc -I/usr/X11R6/include -L/usr/local/lib -lglut -o simpleGlut simpleGlut.c
well what do you know! it didn't give me the usual errors. but there was a new error.

simpleGlut: relocation error: /usr/X11R6/lib/libglut.so.3: undefined symbol: glXQueryExtension

something new for a change. Thanks for sticking with me guys!
I'll look on more into this. Maybe you have encountered this error before? =)

Last edited by paulr1984; 03-16-2004 at 11:34 AM.
 
Old 03-17-2004, 05:25 AM   #8
paulr1984
Member
 
Registered: Dec 2003
Posts: 75

Original Poster
Rep: Reputation: 15
I got it working!

i compiled with:

gcc -I/usr/X11R6/include -L/usr/local/lib -lglut -lGL -lGLU -o simpleGlut simpleGlut.c

how do I compile without using -I and -L? Do I add it to some environment variable?


I have just realized that I can't make widgets with glut alone. I need glow. This time, I'm getting undefined reference errors in my glow program.

I think its because of the makefile. I think it doesn't use the -I and -L tags when compiling.

I'll keep you updated.

Last edited by paulr1984; 03-17-2004 at 05:26 AM.
 
Old 03-17-2004, 09:42 AM   #9
paulr1984
Member
 
Registered: Dec 2003
Posts: 75

Original Poster
Rep: Reputation: 15
hi!

I've just gone through the examples found in the glui package. Does anyone know how to set the glui window as the main graphics window? I don't want the window created with glutCreateWindow. I just need the GLUI *glui = ... create_glui( "title' );.

Also, does anyone know how to load images in glui? I've been through the manual and it doesn't say anything about this.

Thanks!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
GLUT yogotie Programming 4 05-05-2005 09:17 AM
installing glut help needed jacksmash Linux - Software 1 10-17-2004 10:47 PM
Why do you use GLUT? The_Nerd Programming 2 07-13-2004 09:30 AM
installing glut paulr1984 Linux - Software 1 03-08-2004 02:40 AM
Glut???? FXRS Linux - Software 5 07-23-2003 08:18 AM


All times are GMT -5. The time now is 04:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration