Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: glutDisplayFunc problem

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2005
    Posts
    2

    glutDisplayFunc problem

    I am getting this error when I try to compile my program. Note: the program compiled a few months ago and I haven't changed it since. I do not know why. I am on a solaris machine.

    "settingScene.C", line 288: Warning (Anachronism): Formal argument func of type extern "C" void(*)() in call to glutDisplayFunc(extern "C" void(*)()) is being passed void(*)().
    1 Warning(s) detected.
    CC -o settingScene settingScene.o
    Undefined first referenced
    symbol in file
    glShadeModel settingScene.o
    sunOglCurrentContext settingScene.o
    glBegin settingScene.o
    glutInit settingScene.o
    glMatrixMode settingScene.o
    glutDisplayFunc settingScene.o
    glLightfv settingScene.o
    glClearDepth settingScene.o
    glMaterialfv settingScene.o
    glDepthFunc settingScene.o
    glutInitDisplayMode settingScene.o
    glColorMaterial settingScene.o
    glEnd settingScene.o
    glutInitWindowSize settingScene.o
    glClear settingScene.o
    glEnable settingScene.o
    glMaterialf settingScene.o
    glClearColor settingScene.o
    glLoadIdentity settingScene.o
    gluPerspective settingScene.o
    glHint settingScene.o
    glutCreateWindow settingScene.o
    sunOglCurPrimTablePtr settingScene.o
    glutMainLoop settingScene.o
    glutSwapBuffers settingScene.o
    gluLookAt settingScene.o
    ld: fatal: Symbol referencing errors. No output written to settingScene
    *** Error code 1
    make: Fatal error: Command failed for target `settingScene'

  2. #2
    Junior Member Regular Contributor
    Join Date
    Jul 2005
    Location
    Berlin, Germany
    Posts
    188

    Re: glutDisplayFunc problem

    The first warning seems to be caused by using a C++ compiler and not declaring your display function as extern "C".

    The linker errors result from not linking against glut/GLU/GL. Add a "-lglut -lGLU -lGL" (and if necessary -L<path-to-gl-libs>) to your linker call.
    355/113 -- Not the famous irrational number PI, but an incredible simulation!

  3. #3
    Junior Member Newbie
    Join Date
    Sep 2005
    Posts
    2

    Re: glutDisplayFunc problem

    I think I do. This is the header.mak file I use:

    #
    # This header.mak file will set up all necessary options for compiling
    # and linking C and C++ programs which use OpenGL and/or GLUT.
    #
    # To use the GNU C or C++ compiler, add one of the following lines:
    #
    # CC = gcc
    CCC = g++
    #
    OWINC=/usr/openwin/include
    OWLIB=/usr/openwin/lib
    GLUTINC=/usr/local/glut/include
    GLUTLIB=/usr/local/glut/lib/glut

    LDLIBS = -lglut -lGLU -lGLw -lGL -lGLw -lXmu -lXext -lX11 -lm

    INCLUDE = -I$(GLUTINC) -I$(OWINC)
    LIBDIRS = -L$(GLUTLIB) -L$(OWLIB)

    CCFLAGS = -g $(INCLUDE)
    CFLAGS = -g $(INCLUDE)

    LIBFLAGS = -g $(LIBDIRS) $(LDLIBS)

    It used to work, but now it doesnt. Also, the part about the extern C, I saw someone when I was looking for an answer said that happens in solaris and to not worry about it. Don't know if it's true or not, but it didn't happen before.

    Stephen

  4. #4
    Junior Member Regular Contributor
    Join Date
    Jul 2005
    Location
    Berlin, Germany
    Posts
    188

    Re: glutDisplayFunc problem

    Well, LDLIBS/LIBFLAGS certainly has the right content, but it doesn't seem to be used when linking your binary.

    If you are using pre-defined rules for compilation, you should use the variable LDFLAGS instead of LIBFLAGS. If not, make sure you actually have LIBFLAGS in your linker call.
    355/113 -- Not the famous irrational number PI, but an incredible simulation!

Posting Permissions

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