Results 1 to 7 of 7

Thread: multiple definitoin of variable

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2009
    Location
    coimbatore,India
    Posts
    314
    Thanks
    37
    Thanked 47 Times in 43 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: multiple definitoin of variable

    For extern variable:
    ex: extern QList mylist;

    For
    but I constantly receive multiple definition of variable xx.
    Use header guards,
    Ex:
    #ifndef GLOBAL_H
    ........
    #endif

    hope it helps,
    Bala

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 453 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: multiple definitoin of variable

    Quote Originally Posted by BalaQT
    For
    Quote Originally Posted by saman_artorious
    but I constantly receive multiple definition of variable xx.
    Use header guards,
    Ex:
    #ifndef GLOBAL_H
    ........
    #endif

    hope it helps,
    Bala
    Using guard macro in header file is a good practice, but it will not solve the multiple definition problem/error
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

Similar Threads

  1. How to set common variable for multiple Dailogs in Qt
    By jayapandiyan in forum Qt Programming
    Replies: 1
    Last Post: 21st March 2013, 15:08
  2. State variable used by multiple threads
    By bryang in forum Qt Programming
    Replies: 4
    Last Post: 29th April 2012, 20:08
  3. multiple table in a single variable
    By sattu in forum Qt Programming
    Replies: 0
    Last Post: 1st March 2011, 11:01
  4. Replies: 2
    Last Post: 9th December 2010, 16:49
  5. Multiple definition of a variable?
    By T0bi4s in forum Newbie
    Replies: 5
    Last Post: 14th January 2010, 22:13

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
  •  
Qt is a trademark of The Qt Company.