[Qt-interest] Fwd: what is wrong with qt containers
Scott Bloom
scott.bloom at onshorecs.com
Sun Jun 27 07:25:54 CEST 2010
You need to include <Qmap> in the header (and <Qstring>)
The converter object needs it fully defined.
Scott
On 6/26/10 9:42 PM, "Oluwafemi Ade" <oamaximpact at gmail.com> wrote:
> in .h file :
> class QMap<QString, int>;
> static QMap<QString, int> converter;
>
> somewhere in .cpp file:
> #include <QMap>
>
> converter.insert("January", 0);
> converter.insert("February", 1);
> converter.insert("March", 2);
> converter.insert("April", 3);
> converter.insert("May", 4);
> converter.insert("June", 5);
>
> compilers errors so plenty, but here is some
> 'invalid use of incomplete type class QMap<QString, int>' ---it refers to the
> insert lines
> declaration of 'class QMap<QString, int>' it refers to qmap.h
>
> and so many others like that, as a matter of fact, anywhere a container is
> declared and used, it does just that
>
>
> On Sun, Jun 27, 2010 at 12:26 AM, Rohan Prabhu <rohan at rohanprabhu.com> wrote:
>> I guess I was too hasty in my reply. Please do mention the *exact*
>> error that is thrown by the compiler and selective lines of code from
>> the faulty program.
>>
>> On Sun, Jun 27, 2010 at 9:25 AM, Oluwafemi Ade <oamaximpact at gmail.com> wrote:
>>> > Thanks......I of course included <QString>, everything........I think what
>>> > the compiler is saying has to do with the c++ .h file qt generated (I
>>> don't
>>> > know)
>>> >
>>> > On Sat, Jun 26, 2010 at 11:45 PM, Rohan Prabhu <rohan at rohanprabhu.com>
>>> > wrote:
>>>> >>
>>>> >> if you're using QMap<QString, int>, you must include both <QMap> and
>>>> >> <QString>. Only <QMap> won't suffice i.e. you must make sure that if
>>>> >> you're using a container QContainer<Type1, Type2 ... TypeN>, then
>>>> >> Type1, Type2.. TypeN must all be defined completely prior to using the
>>>> >> container.
>>>> >>
>>>> >> On Sun, Jun 27, 2010 at 9:00 AM, Oluwafemi Ade <oamaximpact at gmail.com>
>>>> >> wrote:
>>>>> >> > Hello, I found out that upon using the qt containers such as
>>>>> QMap<key,
>>>>> >> > value_type>, the compiler keeps saying things like invalid use of
>>>>> >> > incomplete
>>>>> >> > type, for ex, I declared QString<QString, int> converter.........and
>>>>> >> > included <QMap> , but it still complains and many other cases that
are
>>>>> >> > so
>>>>> >> > much to begin to list them all here........please any help?
>>>>> >> >
>>>>> >> > _______________________________________________
>>>>> >> > Qt-interest mailing list
>>>>> >> > Qt-interest at trolltech.com
>>>>> >> > http://lists.trolltech.com/mailman/listinfo/qt-interest
>>>>> >> >
>>>>> >> >
>>> >
>>> >
>
>
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100626/a56c734e/attachment.html
More information about the Qt-interest-old
mailing list