PDA

View Full Version : Extern Variable linkage error



mebingj
26th January 2011, 11:07
in my Qt project i have a QString variable in one class(variable is gloablly defined in dialog1.cpp)

QString d;

i am trying to access the same variable from another class (variable is declared as extern in timeall.cpp)

extern QString d;

Wen i compile the file, there appears to be a linker error

collect2: ld returned 1 exit status

Lykurg
26th January 2011, 11:19
can you please post the actual error message.

mebingj
26th January 2011, 11:33
here is the compile output

collect2: ld returned 1 exit status
make: Leaving directory `/root/Desktop/deep (copy)'
make: *** [UNI] Error 1
Exited with code 2.
Error while building project UNI
When executing build step 'Make'

high_flyer
26th January 2011, 12:06
in my Qt project i have a QString variable in one class(variable is gloablly defined in dialog1.cpp)

QString d;
Can you show the code surrounding this declaration?