Results 1 to 2 of 2

Thread: Problem with shadow build and moc_ file while creating new widget

  1. #1
    Join Date
    Jul 2014
    Location
    Germany
    Posts
    14
    Thanks
    3
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Problem with shadow build and moc_ file while creating new widget

    Hello!

    I have a problem using QtCreator (with qmake) and shadow builds. I'm using QtCreator 3.6.1.
    Maybe somebody could give me a hint.

    The problem is the following:
    I created a new spinbox "SpinBox64" (inherited from QSpinBox) and my new widget includes a moc file in the widget's .cpp directly.

    It compiles and works fine, if I do not use shadow builds.
    If I do, I get the following errors:

    error: invalid use of incomplete type 'class SpinBox64Private'
    note: forward declaration of 'class SpinBox64Private'


    This is, because in the shadow build it tries to compile the moc file itself (whereas it's correctly included and not compiled separately in the non-shadow build).

    The "widget_spinbox64.cpp" has the following last line:

    #include "moc_widget_spinbox64.cpp"

    Does anybody has an idea how to solve this problem?
    Last edited by SvenA; 8th June 2016 at 12:47.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Problem with shadow build and moc_ file while creating new widget

    For including the moc file it has to be called exactly like the cpp file, just with .moc as the extension.

    In your case it should probably be
    Qt Code:
    1. #include "widget_spinbox64.moc"
    To copy to clipboard, switch view to plain text mode 

    Cheers,
    _

Similar Threads

  1. MOC_ FIle Issue
    By mhbawa in forum Newbie
    Replies: 5
    Last Post: 24th April 2014, 09:38
  2. QMake problem when using INSTALL and a shadow build directory
    By superpacko in forum Qt Tools
    Replies: 0
    Last Post: 6th September 2011, 15:43
  3. Failed to build Qt 4.7.1 in a shadow build with feature tuning
    By myfifth in forum Installation and Deployment
    Replies: 0
    Last Post: 17th February 2011, 03:25
  4. Replies: 7
    Last Post: 2nd November 2009, 19:07
  5. Multiple Definition errors in moc_<Obj>.cpp and moc_<Obj>_obj.cpp
    By Doug Broadwell in forum Qt Programming
    Replies: 2
    Last Post: 27th October 2007, 19:10

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.