Results 1 to 2 of 2

Thread: Getting multiple definition error from qatomic_x86_64.h

  1. #1
    Join Date
    Apr 2007
    Posts
    23
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Getting multiple definition error from qatomic_x86_64.h

    I am not sure if this is a QT or C++ related issue.

    I have a commonvars.h file that I am using for shared memory location mapping.

    I have the include statement in the main.cpp file that starts the QT app as well as one of my window .cpp files that I want to access the shared memory portions.

    However I get a qatomic_x86_64.h:65 multiple definition of xxxxx error for each of the variables in the commonvars.h file.

    Qt Code:
    1. //commonvars.h
    2. #ifndef COMMONVARS_H
    3. #define COMMONVARS_H
    4.  
    5. blah, balh
    6.  
    7. #endif
    To copy to clipboard, switch view to plain text mode 




    Any help?

    thanks....

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Getting multiple definition error from qatomic_x86_64.h

    If you want to use global variables, you have to declare them only once in a .cpp file and use the extern keyword in header file.

  3. The following user says thank you to jacek for this useful post:

    markcole (30th August 2007)

Similar Threads

  1. how to corss compile for windows in Linux
    By safknw in forum Qt Programming
    Replies: 24
    Last Post: 13th May 2006, 05:23
  2. Replies: 25
    Last Post: 15th January 2006, 00:53

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.