Results 1 to 2 of 2

Thread: Multiple errors 'Multiple definition...' First defined here' .... when build

  1. #1
    Join Date
    Sep 2010
    Posts
    654
    Thanks
    56
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Multiple errors 'Multiple definition...' First defined here' .... when build

    I have 3 custom dlls.
    1.- dll_A
    2.- dll_B it is a plugin with custom widgets that use classes of dll_A
    3-. dll_C , use some classes of dll_A

    The 3 dll's are built ok, without errors.

    Ok, later I have tow approachs to run and build my prog.
    I have for A,B,C
    Qt Code:
    1. #if defined(###_LIBRARY)
    2. # define 1###SHARED_EXPORT Q_DECL_EXPORT
    3. #else
    4. #if defined(###_DIRECT)
    5. # define 1###SHARED_EXPORT
    6. #else
    7. # define 1###SHARED_EXPORT Q_DECL_IMPORT
    8. #endif
    9. #endif
    To copy to clipboard, switch view to plain text mode 

    Depending If I'm working with Library approach or direct way I define
    DEFINE += ###_LIBRARY or DEFINE += ###_DIRECT ( in this case I use all the files as is they were loaded into my project)

    All worked fine until I want to use the DLL_C. I have a lot of errors
    'Multiple definition...' First defined here' ....

    My program use classes of DLL_A and DLL_B, which use itself classes of DLL_A.

    If I use the LIBRARY approach I have 5 errors against 395 errors if I use DIRECT approach. In any case, I have this 'multiple definition'... what can I do to solve it ?
    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: Multiple errors 'Multiple definition...' First defined here' .... when build

    You can remove multiple definitions of symbols from your code. The compiler tells you where they are.
    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. QT Application gives Multiple Definition Link Error
    By behlkush in forum Qt Programming
    Replies: 4
    Last Post: 10th March 2015, 03:52
  2. qmake - multiple definition ?
    By zaphod77 in forum Installation and Deployment
    Replies: 3
    Last Post: 6th April 2011, 12:11
  3. Multiple definition of a variable?
    By T0bi4s in forum Newbie
    Replies: 5
    Last Post: 14th January 2010, 22:13
  4. Multiple Definition errors in moc_<Obj>.cpp and moc_<Obj>_obj.cpp
    By Doug Broadwell in forum Qt Programming
    Replies: 2
    Last Post: 27th October 2007, 19:10
  5. Getting multiple definition error from qatomic_x86_64.h
    By markcole in forum General Programming
    Replies: 1
    Last Post: 30th August 2007, 19:39

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.