Mailing List Archive

Support open source code!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tlug: gcc use



From: Muni <fukudam@example.com>
Message-ID: <37FD7F4F.CECECFA2@example.com>
> Hi, I'm a newbie in linux (just installed Vine Linux last week).
> Well, I wanted to learn OpenGL programming, so I downloaded stuffs like
> GL lib and include files from MESA site. The HOWTO says that I'm 
> supposed to copy all the GLlib and includes in /usr/local/lib and
> /usr/local/includes respectively.  Then I tested with demos and they
> didn't run.. So I copied the lib and includes again from the original
> to /usr/lib and /usr/includes. And this time, it worked fine. All the
> demos (except ones which need hardware acceleration) ran.
>    So now I tried to compile one of the sample codes that came with
> the lib. However, it won't compile. gcc returns:
> 
> $ gcc hello.c
> /tmp/cca031351.o: In function `display':
> /tmp/cca031351.o(.text+0x9): undefined reference to `glClear'
> /tmp/cca031351.o(.text+0x20): undefined reference to `glColor3f'
> /tmp/cca031351.o(.text+0x2a): undefined reference to `glBegin'
> /tmp/cca031351.o(.text+0x3e): undefined reference to `glVertex3f'
> /tmp/cca031351.o(.text+0x52): undefined reference to `glVertex3f'
> /tmp/cca031351.o(.text+0x66): undefined reference to `glVertex3f'
> /tmp/cca031351.o(.text+0x7a): undefined reference to `glVertex3f'
> /tmp/cca031351.o(.text+0x82): undefined reference to `glEnd'
> /tmp/cca031351.o(.text+0x87): undefined reference to `glFlush'
> ......
> 
> What am I missing?  Do I need to specify some sort of path to the
> lib or includes?

You need to specify which libraries you link against your program.
Try following compilation:
$ gcc -o hello hello.c -lMesaGLU -lMesaGL -lXext -lXmu -lX11 -lm

'man gcc' tells you about the compile options.

Takeshi

--
Takeshi Hakamada
E-mail: hakamada@example.com, URL: http://reality.sgi.com/hakamada/
Phone:  81-3-5488-5597, Fax: 81-3-5420-7208, V-Net: 822-1300
-------------------------------------------------------------------
Next Technical Meeting: October 9 (Sat), 13:30   place: Temple Univ.
* Linux Internationalisation Initiative (Li18nux) speaker: Akio Kido
* Japanese TrueType Fonts                     speaker: Adrian Havill
Next Technical Meeting: November 13 (Sat), 13:30 place: Temple Univ.
* Network Security                               speaker: Steve Baur
Next Nomikai:  December 17 (Fri), 19:00 Tengu TokyoEkiMae 03-3275-3691
-------------------------------------------------------------------
more info: http://www.tlug.gr.jp        Sponsor: Global Online Japan


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links