Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

rausse

errors comping simple program

This topic is 5881 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m attempting to get OpenGL running on an OpenBSD system, and I''m running into a problem. I''m just trying to compile a very simple example program from NeHe, and I''m getting lots of errors like this: /tmp/ccc25811.o: Undefined symbol `_glutInit'' referenced from text segment glutInit is a function call that is defined in glut.h, and I would assume is implemented in the shared library libglut.so.3.7, which I have. I''m using the following compile command: gcc -Wall -o try try.c -I/usr/X11R6/include/ -I/usr/local/include/ -L/usr/local/lib/libglut.so.3.7 -L/usr/X11R6/lib/libGLU.so.1.3 -L/usr/X11R6/lib/libGL.so.1.2 -L/usr/X11R6/lib/libGLw.a Help?

Share this post


Link to post
Share on other sites
Advertisement
It may help to toss your compile statement into a Makefile. This is an example makefile I used for a project last year in Unix/Linux. I don''t know how much you know about makefiles, but this worked for me. It should work, provided your link and include directories are correct. Let me know if it works, I usually develop using MSV C++ but want to start writing demos in linux again. Its just the best way to go...

CFLAGS= -I/eng/home/easgst25/include
LIBFLAGS = -L/eng/home/easgst25/lib
simple: simple.o
g++ ${CCFLAGS} ${LIBFLAGS} -o simple simple.o \
-lglut -lGLU -lGL -lm -lX11 -lXmu -lpthread

simple.o: simple.c
g++ ${CCFLAGS} -c simple.c

Share this post


Link to post
Share on other sites
Thanks! It did work. The problem was that I was trying to specifty the entire library with the -L flag. I needed instead to specify the library path with -L and the actual library with -l. I''m not really a C programmer, so I''m unfamiliar with these compiler flags. In the end, if you use a compile command like:

gcc -Wall -o try try.c -I/usr/X11R6/include/ -I/usr/local/include/ -L/usr/local/lib -L/usr/X11R6/lib -lglut -lGLU -lGL

everything works out wonderfully. I agree that make''s definitely the way to go. Incase anyone''s interested, here''s my makefile.

COMP=gcc
FLAGS=-Wall
INC=-I/usr/X11R6/include/ -I/usr/local/include/
LIBPATH=-L/usr/local/lib -L/usr/X11R6/lib
LIBS=-lglut -lGLU -lGL

try: try.c
${COMP} ${FLAGS} -o try try.c ${INC} ${LIBPATH} ${LIBS}

clean:
rm -f try *~

Now on to the fun stuff....

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!