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

Thread: GLUT problem

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2002
    Posts
    13

    GLUT problem

    Hi
    im new to programming with opengl, and im using GLUT for windows. I use gcc for windows to compile, but when i compile, it throws me some errors:
    C:\windows\temp\ccZAufgb.o(.text+0x2ea):cuad.c: undefined reference to `glutMainLoop'

    It throws many of this errors more than 10.
    This is how i compile it with the gcc:

    gcc myprog.c -o myprog.exe -Iincludedir -Llibrariesdir -lglut32 -lglu32 -lopengl32

    I've also tried using -lglut but its the same, any ideas on this?

    If someone can help me i will be very appreciated, since i really want to learn how to program in opengl
    Sorry for my poor english but im from Argentina
    ¿Que es lo imposible, sino el fracaso de los cobardes?

  2. #2
    Senior Member OpenGL Pro
    Join Date
    May 2001
    Location
    Kristianstad,Skåne,Sweden
    Posts
    1,595

    Re: GLUT problem

    Hi !

    First check if you have the glut library, if not then that explains it, it could also be the order of the libraries, ld is picky about this so it's possible that you must put -lglut at the end.

    Mikael

  3. #3
    Junior Member Newbie
    Join Date
    Jul 2002
    Posts
    13

    Re: GLUT problem

    Thanks for the answer, but nope, its the same wherever i put it, ive tried all the combinations posible and keeps saying the same 18 errors
    Ive got all the libraries (i guess), i have

    Dinamic (in windows\system):
    glut32.dll
    glut.dll

    static (in my defined directory):
    glut.lib
    glut32.lib
    ¿Que es lo imposible, sino el fracaso de los cobardes?

  4. #4
    Guest

    Re: GLUT problem

    You can remove glut.dll and glut.lib if you have not installed SGI's OpenGL implementation. The glut32.lib is for Microsoft's compiler but probably works. The problem is that you are using -lglut32 so the the system will look for libglut32.a. The easiest is to rename glut32.lib but I think that a command line with glut32.lib will also work.

    Some corrections:
    - glut32.lib is not a pure static library it is a import library
    - Mikael givs the logical but incorrect order. See http://users.actcom.co.il/~choo/lupg...tml#link_order

  5. #5
    Junior Member Newbie
    Join Date
    Jul 2002
    Posts
    13

    Re: GLUT problem

    Thx for th link Zico!, its good to know this kind of info
    still, how do i know which library uses stuff from another?, do i have to open them and see the functions it uses?

    im using the port for windows of the GNU gcc, so it shouldnt look for libglut32.a, am i right?, still ive changed the name of glut32.lib to libglut32.a and still the same errors. Ive also tried using -lglut32.lib instead of -lglut32 but tells me no such file or directory
    ¿Que es lo imposible, sino el fracaso de los cobardes?

  6. #6
    Guest

    Re: GLUT problem

    I do not know how to find out which library uses stuff from another. In most cases do you know it anyway like GLUT is using stuff from OpenGL. If you have to rearrange the order will the linker give a error message anyway. This is not the solution here since GLUT is not used in the other libraries.

    The compiler should look for libglut32.a if you told it to do so with -lglut32. Strange that it did not work even if you renamed the file. If you have a glut32.lib should you not use -lglut32.lib but something like
    gcc myprog.c -o myprog.exe -Iincludedir -Llibrariesdir glut32.lib -lglu32 -lopengl32
    Do the above work if you place a copy of glut32.lib in the same directory?

    Perhaps is the compiler not installed correct? Can you build the first 5 of NeHe's tutorials? (with the -mwindows switch)

  7. #7
    Senior Member Regular Contributor
    Join Date
    Mar 2002
    Location
    Pori, Finland
    Posts
    191

    Re: GLUT problem

    I have the same problem, thought I get a LOT of linking errors.

  8. #8
    Junior Member Newbie
    Join Date
    Jul 2002
    Posts
    13

    Re: GLUT problem

    i gonna commit suicide one of this days

    i tried again renaming glut32.lib to libglut32.a and saw a line that passed too fast in the DOS window cause of the error lines it throws after, it said something like this:

    'glut32.lib' its not supported by this configuration of GCC

    sorry for missing that meaningless line
    Then i went to try and compile it with Borland C++ 5.5.1 command line, but kept saying this:

    Error E2209 myprog.c 1: Unable to open include file 'stdlib.h'
    Error E2209 myprog.c 2: Unable to open include file 'GL\glut.h'

    even though the headers where in the corresponding directories!

    So please Zico, any ideas on how to solve this problem or of a good compiler that doesnt take too much space cause i dont wanna waste 300megs just for a compiler?

    Perhaps is the compiler not installed correct? Can you build the first 5 of NeHe's tutorials? (with the -mwindows switch)
    sorry but i dont know whats that Nehe tutorial or where to get it, the program im trying to compile is one taken from the book OpenGL: Programming Guide Third Edition

    blender:
    are you using the same compiler i am?

    [This message has been edited by Batsu (edited 07-13-2002).]
    ¿Que es lo imposible, sino el fracaso de los cobardes?

  9. #9
    Guest

    Re: GLUT problem

    The errors from Borland certainly indicates that it is not installed correct. Try first to compile a little hello world program. Perhaps is the enviroment variable not right.

    Even if the files has the same name so is the format for Borland and MSVC .lib files different. You need to convert glut32.lib with coff2omf for Borland.

  10. #10
    Senior Member Regular Contributor
    Join Date
    Mar 2002
    Location
    Pori, Finland
    Posts
    191

    Re: GLUT problem

    I have the gcc compiler which comes with Bloodshed's Dev-C++ 4.9.3.0 IDE.
    It is no problem to compile opengl projects
    (including NeHe's tutorials), but glut just wont work.

Page 1 of 2 12 LastLast

Similar Threads

  1. Problem with using GLUT
    By Savail in forum OpenGL: General
    Replies: 4
    Last Post: 09-02-2010, 09:10 AM
  2. Problem with glut.h
    By Redundant in forum OpenGL: General
    Replies: 0
    Last Post: 12-29-2005, 07:56 AM
  3. GLUT Problem
    By bra-ket in forum OpenGL: General
    Replies: 7
    Last Post: 02-09-2004, 07:59 PM
  4. Problem with GLUT
    By marlesno in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 11-17-2003, 05:42 AM
  5. Help! Problem about Glut
    By Dickie in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 09-21-2003, 06:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean