Results 1 to 2 of 2

Thread: Non-existing multiple definition bug

  1. #1
    Join Date
    Jul 2010
    Location
    Russia, Moscow/Krasnodar
    Posts
    5
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Non-existing multiple definition bug

    Hello, $username!

    I have one very strange bug with a student project, which sometimes fantastically disappeares but appeares again.

    QtCreator/ld says that i have multiply defined function and says something like "first defined here" and points to the strange places like machine code of main.o or (sic!) assembler inlines in some qt core headers.

    Sometimes after directory cleaning, it compiles - but next time after the same procedures it points errors again!

    Could you compile attachement yourself to see what's really happening?

    It is the reason i can't really code what i have to.

    jfyi, the project structure:

    Qt Code:
    1. QT += core gui
    2.  
    3. TEMPLATE = app
    4.  
    5. INCLUDEPATH += . \
    6. gui \
    7. logic \
    8. manager
    9.  
    10. TARGET = Ants
    11. CONFIG += console
    12. CONFIG -= app_bundle
    13.  
    14. HEADERS = main_window.hpp \
    15. gui/AntWidget.hpp \
    16. gui/IAntGUI.hpp \
    17. gui/IAntGuiImpl.hpp \
    18. logic/IAntLogic.hpp \
    19. logic/IAntLogicImpl.hpp \
    20. manager/AntManager.hpp
    21.  
    22. SOURCES = main.cpp \
    23. main_window.cpp \
    24. gui/AntWidget.cpp \
    25. gui/IAntGUI.cpp \
    26. gui/IAntGuiImpl.cpp \
    27. logic/IAntLogic.cpp \
    28. logic/IAntLogicImpl.cpp \
    29. #manager/AntManager.cpp
    30.  
    31. FORMS += MainForm.ui
    To copy to clipboard, switch view to plain text mode 

    TIA.


    Added after 7 minutes:


    All the headers have ifndef-define-endif pattern.
    Attached Files Attached Files
    Last edited by uGin; 17th May 2011 at 16:29.

  2. #2
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    131
    Thanks
    11
    Thanked 16 Times in 16 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Non-existing multiple definition bug

    Two solutions:

    1.) make all methods of AntManager inline or
    2.) move the implementation of AntManager to the cpp

    for more info whats happinging here, see http://stackoverflow.com/questions/2...me-header-file

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. Replies: 1
    Last Post: 17th May 2011, 16:12
  3. qmake - multiple definition ?
    By zaphod77 in forum Installation and Deployment
    Replies: 3
    Last Post: 6th April 2011, 12:11
  4. Multiple definition of a variable?
    By T0bi4s in forum Newbie
    Replies: 5
    Last Post: 14th January 2010, 22:13
  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.