navi Messages: 107 Registered: February 2012 Location: Sydney, Australia
Experienced Member
[quote title=nlneilson wrote on Thu, 29 November 2012
maybe have
H1.h
void Set_t1(String a){ t1<<=a; }
H2.h
if ( a > b ) Set_t1("2 OK");
but get this error
H2.h(16) : error C3861: 'Set_t1': identifier not found
but in H1.h it is under public:
[/quote]
its not a valid scope to call Set_t1() this way. Set_t1 is in H1 Class scope so you need to call it using a object such as my_h1.Set_1();
but your H1 object is bound in main function and not accessible from global scope, since its only exist inside the main function.
// in h1.h file
struct H1 : public WithTest2Layout<TopWindow> {
public:
typedef H1 CLASSNAME;
H1();
void AddNum(int a, int b){
if(a>=b)
t1<<="1 OK";
}
void AddNum2(int a, int b);
void Set_t1(String a) {t1<<=a;}
};
// in h2.h file
#include "h1.h"
// it is now valid to call Set_t1 as AddNum2 is now also in the
// same class scope.
void H1::AddNum2(int a, int b){
if ( a > b )
// t1<<="2 OK";
Set_t1("2 OK");
}