Results 1 to 12 of 12

Thread: compiler error in calling friend function!!??

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: compiler error in calling friend function!!??

    Assuming that friendFunction() will ultimately need access to private parts of your Window class (it doesn't at the moment as Santosh Reddy points out)...

    Line 14 of window.h is a grant of privileges, not a forward declaration of a function friendFunction(), which is what is needed in order for your implementation to compile. Add this line:
    Qt Code:
    1. void friendFunction();
    To copy to clipboard, switch view to plain text mode 
    to the top of window.cpp. This forward declaration would typically be in a header included by the implementations that need to know that the function exists.

  2. The following user says thank you to ChrisW67 for this useful post:

    aurora (14th November 2011)

Similar Threads

  1. Calling external DLL function with Qt
    By yaba in forum Newbie
    Replies: 2
    Last Post: 29th September 2011, 07:47
  2. fatal error C1001: An internal error has occurred in the compiler
    By noodles in forum Installation and Deployment
    Replies: 0
    Last Post: 12th August 2010, 11:24
  3. Compiler error when calling QObject::connect. What am I missing?
    By themanwiththequestion in forum Qt Programming
    Replies: 4
    Last Post: 2nd February 2010, 14:33
  4. friend function in QT
    By aj2903 in forum Qt Programming
    Replies: 1
    Last Post: 12th March 2009, 14:59
  5. QTextBrowser and friend function
    By probine in forum Qt Programming
    Replies: 4
    Last Post: 14th December 2006, 17:03

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.