trinity-devel@lists.pearsoncomputing.net

Message: previous - next
Month: January 2012

Re: [trinity-devel] "undefined reference to" error

From: Darrell Anderson <humanreadable@...>
Date: Mon, 2 Jan 2012 12:06:52 -0800 (PST)
> > While trying to compile koffice I ran into these fatal
> errors:
> > 
> > ../../.libs/libkexidb.so: undefined reference to
> > `KexiDB::Parser::~Parser()' ../../.libs/libkexidb.so:
> undefined
> > reference to `KexiDB::Parser::statement()
> > const' ../../.libs/libkexidb.so: undefined reference
> to
> > `KexiDB::Parser::parse(QString const&)'
> ../../.libs/libkexidb.so:
> > undefined reference to `tname(int)'
> ../../.libs/libkexidb.so:
> > undefined reference to
> > `KexiDB::Parser::Parser(KexiDB::Connection*)'
> ../../.libs/libkexidb.so:
> > undefined reference to `KexiDB::Parser::query()'
> > 
> > If the g++ error lists a line in a *.cpp file, then
> usually the
> > "undefined reference to" error means a missing header
> file that
> > declares the namespace or function.
> > 
> > In this particular error, g++ listed a static library.
> From what I've
> > read, this means something is awry in the linking
> process and not in
> > the code itself. Am I on the right track?
> > 
> > If not then please set me straight. :)
> > 
> > If yes, then how do I fix the error? I presume
> something in the
> > Makefiles? Does the error provide me clues as to where
> I need to fix
> > the problem?

> You need to add the library containing the missing symbols
> to the linker flags.

Thanks so much for helping. This is causing headaches. :)

I more or less figured out there is a linking problem, but I don't know what needs to be linked, what files to edit, or what command line parameters to pass.

The undefined reference to "KexiDB::" implies a class or namespace (still learning terminology!), but in which *.cpp or *.h file? My guess is I don't need to edit any *.cpp or *.h file but the problem is caused by the stricter compiling standards of the newer GCCs.

How do I read my build log to know which library is the one that needs to be linked? The way I read the errors (and I could be way wrong :) ), is the linker sees libkexidb.so with some references that the linker can't find. Does the build log provide me that information?

If koffice could be built in separate packages chasing this bug would not be so demoralizing. Building koffice takes about 1 hour 49 minutes on my system. The failure occurs at about 1 hour 30 minutes. I have posted list questions how to build koffice differently but received no responses yet.

I want to build koffice mostly to have access to KWord, but I want like to know how to build kofffice with any component removed. There also is a configure statement in the build log about building kexi separately, but I don't know how to set my configure options to do that. If I could then I would save much time by just building kexi because that is where the failure lies.

Darrell