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
ld: fatal: Symbol referencing errors. No output written to settingScene
*** Error code 1
make: Fatal error: Command failed for target `settingScene’
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.
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++
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.
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.