[Qt-interest] Splitting library?
Anatoly Burakov
burakov.anatoly at googlemail.com
Wed Feb 10 19:48:49 CET 2010
Hong Jiang wrote:
> Are you sure it is a compiler error? Or is it a linker error?
>
> --Hong
>
> On Wed, Feb 10, 2010 at 10:34 AM, Anatoly Burakov
> <burakov.anatoly at googlemail.com
> <mailto:burakov.anatoly at googlemail.com>> wrote:
>
> 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
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com <mailto:Qt-interest at trolltech.com>
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
Well, yes, it is a linking error - but still it is an error, and i would
like to know how to fix it.
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/ef9ff005/attachment.bin
More information about the Qt-interest-old
mailing list