Results 1 to 2 of 2

Thread: Multi defined QVector<float>::QVector<float>

  1. #1
    Join Date
    Dec 2006
    Posts
    426
    Thanks
    8
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Multi defined QVector<float>::QVector<float>

    Hi,

    I have the following codes:
    Qt Code:
    1. #include <QVector>
    2.  
    3. template <typename Type>
    4. class MyVector : public QVector<Type>
    5. {
    6. ,,,
    7. };
    8.  
    9. template class IMPORT_EXPORT MyVector<float>;
    10. typedef MyVector<float> MyFloatVector;
    To copy to clipboard, switch view to plain text mode 

    The above code is built into a dll library, with IMPORT_EXPORT properly defined.

    Then I have another dll using QVector<float> directly, such as
    Qt Code:
    1. #include <QVector>
    2.  
    3. class AnotherClass
    4. {
    5. public:
    6.  
    7. QVector<float> foo() const {
    8. return QVector<float>();
    9. }
    10.  
    11. }
    To copy to clipboard, switch view to plain text mode 

    When linking them together, I got QVector<float>::QVector<float> already defined error. This only happens on Windows. Linux is fine.

    Can someone tell me what is the problem?

    Many thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Multi defined QVector<float>::QVector<float>

    Mark the method in AnotherClass as inline.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. sort a Qvector based on another Qvector
    By OzQTNoob in forum Qt Programming
    Replies: 2
    Last Post: 16th February 2012, 06:39
  2. Replies: 5
    Last Post: 2nd September 2011, 23:11
  3. Replies: 4
    Last Post: 18th May 2011, 17:59
  4. QVector<float> to QByteArray without programming
    By Naami in forum Qt Programming
    Replies: 2
    Last Post: 23rd May 2010, 13:40
  5. Replies: 1
    Last Post: 10th February 2009, 09:42

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.