-
global variables
HI,
I have two classes
AppUI and operations
in Appui.h
--------------
class appui
{
----------------------
Buf<KMaxTextLength> Body;
}
in operations.h
--------------------
const TInt KMaxTextLength=100;
class operations
{
-----------------------------
Buf<KMaxTextLength> Body;
}
----------------------------
my problem is how to declare const TInt KMaxTextLength=100;
when I declare it in one class and compile the code the other class shows error "KMaxTextLength not declared in this scope"
how to solve this.
Regards!
-
I think you should really declare the int in only one of the header files, and then declare the other var as extern. Include the headers in the right order in the .cpp files, and then redeclare the extern var again, except this time not as extern.....
-
Use code tags: [code] code here [/code]
In one of the header files, use
Code:
const TInt KMaxTextLength=100;
and in the other, use
Code:
extern const TInt KMaxTextLength;
[edit] As MacGyver said. [/edit]