Compiler error in calling friend function!!??



  • i declared a friend function in one class...as shown below...

    classa.h

    @ class A
    {
    public:
    friend void friendFunction(void);
    void somefunction(void);
    .................
    }@

    classa.cpp

    @
    void class A::somefunction()
    {
    ......
    friendFunction();
    }
    @

    main.cpp
    @
    ..........
    .............
    void frienFunction(void)
    {
    /* function implementation...*/
    }

    @

    but i'm getting compiler error saying that "friendFunction not declared in this class"
    please help me whats the wrong here!??



  • It's not relevant to Qt but you should add another declaration of friendFunction() before definition of class A.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.