LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-18-2004, 10:42 PM   #1
mdavidn
LQ Newbie
 
Registered: Apr 2004
Distribution: FreeBSD 5.3
Posts: 22

Rep: Reputation: 15
Question Linker erros using FreeGLUT on Slackware


Hello,

First of all, please be patient with me. I'm primarily a Java programmer whose only experiences with C/C++ are on Windows using BCC 5.5 and (unfortunately) VC6 and VC7 (in MSVS.NET).

I'm trying to compile a few extremely simple GLUT projects written in C++. I followed the FreeGLUT 2.2.0 installation instructions, and gcc seems to find all the appropriate header files without any trouble. However, the linker spills out an "undefined reference" error for each and every GLUT, GLU, and GL function call in my program. The GLUT library files were installed in /usr/local/lib, and the GL and GLU libraries appear to be in /usr/X11R6/lib. Both paths are listed in /etc/ld.so.conf (although I'm not quite sure what that does).

I honestly couldn't tell you which OpenGL library I'm using. I am using an out-of-the-box installation of Slackware 9.1 and the most recent Nvidia display drivers.

The following URL contains the output given by `gcc -v hw5_1b.cpp`:
mdavidn.freeshell.org/shared/gcc.txt

Please assist. I am quite lost in the vast gcc documentation.

Matthew
 
Old 04-19-2004, 02:47 AM   #2
mdavidn
LQ Newbie
 
Registered: Apr 2004
Distribution: FreeBSD 5.3
Posts: 22

Original Poster
Rep: Reputation: 15
Well, now I am really confused. Take these two commands:
Code:
$ gcc -c hw5_1b.cpp
hw5_1b.cpp: In function `void myReshape(int, int)':
hw5_1b.cpp:160: warning: initialization to `GLint' from `GLfloat'
hw5_1b.cpp:160: warning: argument to `int' from `GLfloat'
hw5_1b.cpp:161: warning: passing `GLfloat' for argument passing 4 of `void
   glViewport(int, int, int, int)'
hw5_1b.cpp:161: warning: argument to `int' from `GLfloat'
hw5_1b.cpp:166: warning: initialization to `GLint' from `GLfloat'
hw5_1b.cpp:166: warning: argument to `int' from `GLfloat'
hw5_1b.cpp:167: warning: passing `GLfloat' for argument passing 3 of `void
   glViewport(int, int, int, int)'
hw5_1b.cpp:167: warning: argument to `int' from `GLfloat'
$ ld hw5_1b.o /usr/local/lib/libglut.so /usr/lib/libGL.so /usr/X11R6/lib/libGLU.so /usr/lib/crt1.o /usr/lib/libc.so
These two commands generate an a.out file without displaying any error messages, yet the file does not run:
Code:
$ ls -l a.out
-rwxr-xr-x    1 mdavidn  users       15048 Apr 18 23:36 a.out*
$ ./a.out
-bash: ./a.out: No such file or directory
I would greatly appreciate any help y'all can offer. In the meantime, I'll google for some better tutorials. I have no idea if I'm going about this the right way.

By the way, I discovered my Nvidia OpenGL libraries in /usr/lib, as you can see in the linker arguments.

mdavidn

Last edited by mdavidn; 04-19-2004 at 02:48 AM.
 
Old 04-19-2004, 02:55 AM   #3
mdavidn
LQ Newbie
 
Registered: Apr 2004
Distribution: FreeBSD 5.3
Posts: 22

Original Poster
Rep: Reputation: 15
Oh, also ... I know that OpenGL, GLU, and FreeGLUT are somehow working properly, because I can run the FreeGLUT demo programs. Unfortunately, the scripts and makefiles that build and run the demos are excessively complicated. I'm afraid I don't understand them.

mdavidn
 
Old 04-19-2004, 03:20 AM   #4
mdavidn
LQ Newbie
 
Registered: Apr 2004
Distribution: FreeBSD 5.3
Posts: 22

Original Poster
Rep: Reputation: 15
Geez ... this is just wrong.

Code:
$ gcc -lglut hw5_1b.ccp
It works.

mdavidn

Last edited by mdavidn; 04-19-2004 at 03:25 AM.
 
  


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
mythfilldatabase erros Lobais Linux - Software 0 12-05-2004 11:30 AM
system's erros on RH9 PC caf Red Hat 0 05-29-2004 02:38 PM
XSession-erros airrr Linux - Newbie 2 04-30-2004 10:11 AM
Compilation erros bruno buys Linux - Newbie 0 11-23-2003 11:18 PM
dropline root erros optics Slackware 2 12-05-2002 10:49 PM


All times are GMT -5. The time now is 08:47 AM.

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