kdevelop -> my file won't link!

From: Quaternion (w_at_r.no)
Date: 08/30/03


Date: Sat, 30 Aug 2003 20:48:22 GMT

Hi,

I have these files

Megaman01.cpp
MScene.cpp
main.c
globals.c

with their respective header files (*.h)

They compile, the app runs, it is an openGL / QtOpenGL app.

But,

MScene.cpp needs this :

#include "globals.c" // !!
to work, because otherwise it says, *AFTER COMPILING THE FILES* :

mscene.o(.text+0x223): In function `MScene::readTextures()':
: undefined reference to `LoadTGA(Texture*, char const*)'

However, it does recognize LoadTGA's prototype, which is defined in
globals.h!! And globals.h is imported by mscene.h, which is where it
recognizes its from. It is the function *body* that is not found, so how
can this be? I used autoconf and then ./configure which worke,d an dlike I
said it only errors *after the files ahve been compiled* it is not a syntax
or parse error.

Like I said this worked, by including "globals.c" explicitly. This is not
pretty as you all know.

But after adding some functionality, I needed a glu function.
MScene.cpp needs and can include this :

#include <GL/glu.h>
naturally.
I link against the GLU library in my project settings, and this shows up in
the Makefile as one of the ldflags.

However, even by including this, I get the same error when trying to make :

 "mscene.o(.text+0x7eb): In function `MScene::resizeGL(int, int)':
: undefined reference to `gluPerspective'

Here is a full dump of my make output :

[maarten@d5764c47 megaman01]$ make
make all-recursive
make[1]: Entering directory `/home/maarten/megaman01'
Making all in megaman01
make[2]: Entering directory `/home/maarten/megaman01/megaman01'
cd .. && automake-1.4 --gnu megaman01/Makefile
cd .. && perl admin/am_edit megaman01/Makefile.in
cd .. \
&& CONFIG_FILES=megaman01/Makefile CONFIG_HEADERS= /bin/sh ./config.status
fast creating megaman01/Makefile
make[2]: Leaving directory `/home/maarten/megaman01/megaman01'
make[2]: Entering directory `/home/maarten/megaman01/megaman01'
/bin/sh ../libtool --mode=link --tag=CXX c++ -O2 -fno-exceptions
-fno-check-new -o megaman01 -L/usr/X11R6/lib -L/usr/lib/qt3/lib
-L/usr/lib -R /usr/lib -R /usr/lib/qt3/lib -R /usr/X11R6/lib globals.o
mscene.o megaman01.o main.o mscene.moc.o megaman01.moc.o
megaman01_meta_unload.o -lkdeui -lkdecore -lqt-mt -lpng -lz -lm -lXext
-lX11 -lresolv -lSM -lICE -lpthread -lresolv
c++ -O2 -fno-exceptions -fno-check-new -o megaman01 globals.o mscene.o
megaman01.o main.o mscene.moc.o megaman01.moc.o megaman01_meta_unload.o
-L/usr/X11R6/lib -L/usr/lib/qt3/lib -L/usr/lib /usr/lib/libkdeui.so
-L/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.2.2
-L/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.2.2/../../.. -lresolv
/usr/lib/libkdecore.so /usr/lib/libDCOP.so -ldl -lresolv -lXinerama
/usr/lib/libart_lgpl_2.so /usr/lib/libkdefx.so -lXrender -lstdc++ -lc
-lgcc_s -lqt-mt -lpng -lz -lm -lXext -lX11 -lresolv -lSM -lICE -lpthread
-lresolv -Wl,--rpath -Wl,/usr/lib -Wl,--rpath -Wl,/usr/lib/qt3/lib
-Wl,--rpath -Wl,/usr/X11R6/lib
mscene.o(.text+0x1db): In function `MScene::resizeGL(int, int)':
: undefined reference to `gluPerspective'
mscene.o(.text+0x223): In function `MScene::readTextures()':
: undefined reference to `LoadTGA(Texture*, char const*)'
collect2: ld returned 1 exit status
make[2]: *** [megaman01] Error 1
make[2]: Leaving directory `/home/maarten/megaman01/megaman01'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/maarten/megaman01'
make: *** [all-recursive-am] Error 2

What could possibly cause MScene.cpp to not accept the functions whoms
prototypes it does find? I will emphasize again it is not a syntax or parse
error: after the compile it doesn't seem to find the bodies of the
functions, *unless I specifically include them in MScene.cpp*

Thanks very much for any possible help. Sorry for the length, I wanted to be
clear.

--
Quaternion


Relevant Pages

  • kdevelop -> my file wont link!
    ... They compile, the app runs, it is an openGL / QtOpenGL app. ... undefined reference to `LoadTGA ... Making all in megaman01 ...
    (comp.os.linux.development.system)
  • Re: Prolog & C linking Problem
    ... >> I am trying to compile Prolog and C using plld. ... PL_initialise_ is an undefined reference ...
    (comp.lang.prolog)
  • How can I compile PF without option PFIL_HOOKS defined in the kernel conf file?
    ... kernel conf file to try to get PF compile into the kernel, ... PF failed to compile; ... : undefined reference to `pfil_head_get' ... Will this fix the problem? ...
    (comp.unix.bsd.openbsd.misc)
  • gprof
    ... I'm trying to compile my C application with gprof but it is not working. ... This is a multithreaded program that use mysql and openssl libraries. ... /lib/libcrypto.so.4: undefined reference to `sysconf' ...
    (freebsd-questions)
  • Re: gprof
    ... I'm trying to compile my C application with gprof but it is not working.. ... This is a multithreaded program that use mysql and openssl libraries. ... /lib/libcrypto.so.4: undefined reference to `sysconf' ...
    (freebsd-questions)