PDA

View Full Version : Getting multiple definition error from qatomic_x86_64.h


markcole
30th August 2007, 19:47
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.


//commonvars.h
#ifndef COMMONVARS_H
#define COMMONVARS_H

blah, balh

#endif





Any help?

thanks....

jacek
30th August 2007, 20:39
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.