Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Linux - compilation problems

  1. #1
    Guest

    Linux - compilation problems

    Previous link
    http://www.opengl.org/discussion_boa...ML/009680.html


    Hi,
    I installed linux 7.2 and when i compiled my code it gives loads of errors. All of them says "undefined reference to <function name>"

    for ex.

    /tmp/cc10oCCFz.o(.text+0x132a):undefined reference to 'glRotatef'


    all the errors are similar to the above(only variation is (.text+0xnumber))

    The error is for all opengl related functions,sine,cos and tan functions.


    I have included all header files


    what is the problem?


    thanks in advance

    simon

  2. #2
    Junior Member Newbie
    Join Date
    Aug 2002
    Posts
    25

    Re: Linux - compilation problems

    sounds liks you're not linking to the opengl libraries.

    try adding
    -lglut32 -lopengl32
    to your compile command.
    should be somethign like this:
    g++ lesson260802.cpp -o test -lglut32 -lglu32 -lopengl32 -Wall

  3. #3
    Junior Member Regular Contributor
    Join Date
    Mar 2001
    Posts
    184

    Re: Linux - compilation problems

    ...sine,cos and tan functions.
    maybe you also need -lm

  4. #4
    Intern Newbie
    Join Date
    Aug 2002
    Posts
    42

    Re: Linux - compilation problems

    For linux, I believe it would be -lglut -lGL -lGLU.

    Note: No 32's in there, and GL and GLU are all caps. Case does matter in Linux.

  5. #5
    Guest

    Re: Linux - compilation problems

    Hi,
    I typed the following command

    g++ filename.C -o test -lglu32 -lglut32 -lopengl32 -Wall

    message is:

    /usr/bin/ld: cannot find -lglu32
    collect2: ld returned 1 exit status


    I tried with -lm and also -lGL & -lGLU, -lGLU32 etc. but the result is same type of error.

    Do i have to set path variables or somthing like that(like windows) after linux installation?

    I'm sure that gl.h, glu.h glut.h files are in /usr/include/GL

    I don't know what i'm missing.

    Help me guys. Hope not annoying you people.


    Thanks
    simon

  6. #6
    Intern Contributor
    Join Date
    Sep 2001
    Location
    paris, france
    Posts
    73

    Re: Linux - compilation problems

    The problem, then, maybe that you have NO the openGL library ?
    what video card do you use ?
    when you say -lGL, it means "link that with the file libGL.so", the file beeing looked for in every path listed in /etc/ld.so.conf.

    So, do you have that file ?
    I suppose at least that the -lm get rid of the complaints about sin, cos, etc... ?

  7. #7
    Guest

    Re: Linux - compilation problems

    Hi
    I have the file libGL.so in \usr\lib. But I don't know whether the path is listed in \etc\ld.so.conf. How to check it?

    By the way my video card is ATI Rage Pro AGP(according to windows). But Linux 7.2 detected as ATI Mach-64.

    I didn't installed any special opengl files. But in windows i downloaded opengl header files, dll files etc. Do I have to do something like that for linux?

    I checked in lib directory and there is a seperate directory for GL.

    I don't know whether i have to install special display drivers for opengl in linux.

    Now I am totally confused.

    Simon

    Originally posted by rixed:
    The problem, then, maybe that you have NO the openGL library ?
    what video card do you use ?
    when you say -lGL, it means "link that with the file libGL.so", the file beeing looked for in every path listed in /etc/ld.so.conf.

    So, do you have that file ?
    I suppose at least that the -lm get rid of the complaints about sin, cos, etc... ?

  8. #8
    Guest

    Re: Linux - compilation problems

    Hi guys
    I tried a simple program in linux

    #include <stdio.h>

    main()
    {
    printf(" \n This is ok. no problemo");
    }

    When I typed a.out, it says
    bash: a.out: command not found

    I tried in different shells(csh,sh). result is same.

    a.out is created in the same working directory

    I dont know what's the mistake.

    Simon

  9. #9
    Intern Newbie
    Join Date
    Aug 2002
    Posts
    42

    Re: Linux - compilation problems

    Try:

    ./a.out

    BTW, you can use -o someMoreRationalName

    To name the binary something other than a.out.

  10. #10
    Guest

    Re: Linux - compilation problems

    atlast ./a.out worked(thanks Latrans). But I still can't execute my opengl code sucessfully.

    By the way, What's the difference between a.out and ./a.out?

    To my knowledge(correct me if i'm wrong), a.out means transferring the machine code(or assembly code) to standard output device.

    Many Thanks
    simon

    Originally posted by Latrans:
    Try:

    ./a.out

    BTW, you can use -o someMoreRationalName

    To name the binary something other than a.out.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •