[Qt-interest] Splitting library?
Anatoly Burakov
burakov.anatoly at googlemail.com
Wed Feb 10 19:34:34 CET 2010
Hi all
This question is not exactly related to QT, more of a general C++
question. Sorry for maybe a n00b-type problem but everyone has to start
somewhere :-)
I have made a small class library for use within a family of
applications. I have separated it into several header/source files one
per class, and one "root" header file which includes all these "child"
header files. This whole library uses a separate namespace. On its own
the library compiles OK, but whenever i try to include the "root"
library header into the other project and try to use classes from the
library - compiler can't find them (although IDE itself can - it lists
all member functions when autocompleting code etc.) and gives an error
of "undefined reference to Namespace::ClassName()::ClassName()". Am i
missing something? By the way, the library worked fine when it was not
separated into several files, so there must be something i don't
understand about how headers work...
The structure of the root header file is following:
-------------------------
#include <math.h>
namespace Namespace {
// classes pre-declarations follow here e.g.
class childOne;
class childTwo;
// helper function header used throughout the class library e.g.
double hlpFunc(const double &value);
// helper enum used throughout the class library e.g.
enum hlpEnum {
varA = 0, varB = 5, varC = 10
};
}
// includes for child classes' headers e.g.
#include "childone.h"
#include "childtwo.h"
-------------------------
Best regards,
Anatoly
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5238 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100210/9718b002/attachment.bin
More information about the Qt-interest-old
mailing list