Results 1 to 7 of 7

Thread: #include class

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: #include class

    thanks, but I worried for recursive inclusion; I already inserted "class myMainForm" in myLightDialog Class (.h); that's the .cpp; Don't I have to insert "#include <mymainform.h> there" (in the .cpp)?
    Regards

  2. #2
    Join Date
    Mar 2006
    Location
    The Netherlands
    Posts
    300
    Thanks
    9
    Thanked 29 Times in 29 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: #include class

    Yes, include mymainform.h into mylightdialog.cpp. In mydialog.h you only needed the name. In the .cpp you need the actual class (probably).
    "The strength of a civilization is not measured by its ability to wage wars, but rather by its ability to prevent them." - Gene Roddenberry

  3. #3
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: #include class

    Quote Originally Posted by Michiel
    Yes, include mymainform.h into mylightdialog.cpp. In mydialog.h you only needed the name. In the .cpp you need the actual class (probably).
    sorry but #include "mymainfrom.h" in .cpp seems necessary....don't compile with only class mymainform...
    these are the errors:
    Qt Code:
    1. myLightDialog.cpp(27): error C2027: use of undefined type 'myMainForm'
    2. myLightDialog.cpp(27): error C2227: left of '->isEnabled' must point to class/struct/union
    3. myLightDialog.cpp(27): error C2227: left of '->tab1' must point to class/struct/union
    4. myLightDialog.cpp(28): error C2027: use of undefined type 'myMainForm'
    To copy to clipboard, switch view to plain text mode 
    Regards

  4. #4
    Join Date
    Mar 2006
    Location
    The Netherlands
    Posts
    300
    Thanks
    9
    Thanked 29 Times in 29 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: #include class

    Yes, it is necessary, like I said.

    In the .h file you only use 'class myMainForm'. In the .cpp file you use '#include "mymainform.h"'.

    This way you won't get compiler errors, and you won't have recursive inclusion (which would only have happened with '#include ...' in the .h file).
    "The strength of a civilization is not measured by its ability to wage wars, but rather by its ability to prevent them." - Gene Roddenberry

Similar Threads

  1. QApplication: no such file or directory
    By jochen_r in forum Newbie
    Replies: 13
    Last Post: 15th November 2008, 21:46
  2. Replies: 7
    Last Post: 2nd June 2006, 12:48
  3. Replies: 2
    Last Post: 4th May 2006, 19:17
  4. use button from another Window
    By raphaelf in forum Qt Programming
    Replies: 11
    Last Post: 2nd March 2006, 20:31
  5. Problems with Q_OBJECT and subclassing
    By renaissanz in forum Qt Programming
    Replies: 4
    Last Post: 21st February 2006, 22:18

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.