Message: previous - next
Month: December 2011

"undefined reference to" error

From: Darrell Anderson <humanreadable@...>
Date: Fri, 30 Dec 2011 20:27:24 -0800 (PST)
Slowly, ever so slowly, I'm trying to learn C++. I have this Big Fat Book on my desk and almost every day I read, tinker, and study code.

While trying to compile koffice I ran into these fatal errors:

../../.libs/ undefined reference to `KexiDB::Parser::~Parser()'
../../.libs/ undefined reference to `KexiDB::Parser::statement() const'
../../.libs/ undefined reference to `KexiDB::Parser::parse(QString const&)'
../../.libs/ undefined reference to `tname(int)'
../../.libs/ undefined reference to `KexiDB::Parser::Parser(KexiDB::Connection*)'
../../.libs/ 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?

Trying to learn! Thanks!