Results 1 to 10 of 10

Thread: include "QDialog" etc not found after upgrade from 5.4 to 5.6

  1. #1
    Join Date
    Jun 2012
    Posts
    38
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default include "QDialog" etc not found after upgrade from 5.4 to 5.6

    Dear all,

    this is a bit stupid. I had a working environment with QT5.4 and Qtcreator. I just upgraded to QT5.6 and qtcreator to 3.1, when I now want to recompile by code I get:

    Qt Code:
    1. fatal error: QLabel: No such file or directory
    2. #include <QLabel>
    To copy to clipboard, switch view to plain text mode 


    So before this was working fine, I could compile without error, but now I need to specify

    Qt Code:
    1. #include <QtWidgets/QLabel>
    To copy to clipboard, switch view to plain text mode 

    etc. My code is quite large with many includes, do I really need to specify QNetwork, QWidgets etc. for every include?? or do I have a an environment variable set wrong or missing?

    I also have lots of warning such as

    Qt Code:
    1. Makefile:1248: warning: overriding commands for target `moc_mainwindow.cpp'
    2. Makefile:1064: warning: ignoring old commands for target `moc_mainwindow.cpp'
    To copy to clipboard, switch view to plain text mode 


    I run on Ubuntu,

    which qmake
    /opt/Qt5.6.0/5.6/gcc_64/bin/qmake

  2. #2
    Join Date
    Jun 2012
    Posts
    38
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: include "QDialog" etc not found after upgrade from 5.4 to 5.6

    Does nobody have an idea, or is the problem so obvious that no-one bothers to answer :-)


    I am quite sure it is some dumb mistake from my side, an include path or lib path that is not correct, but I don't see the problem.

    I have removed the .pro file
    do qmake -project
    qmake
    make


    hereafter I get the error such as :

    fatal error: QApplication: No such file or directory
    #include <QApplication>
    ^
    compilation terminated.



    if I modify the include and specify the dir such as i.e. <QtWidgets/QLabel> and so on it does work, but it is annoying to have to do that for every lib I use.

    what am I missing here?

  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: include "QDialog" etc not found after upgrade from 5.4 to 5.6

    In your .pro file, you should be specifying additional include paths <QT_DIR>/include, <QT_DIR>/include/QtCore, <QT_DIR>/include/QtWidgets, etc. where <QT_DIR> is the path to your Qt installation (or an environment variable that says the same thing). These might have been in your .pro file, but when you deleted it it, they were lost.

    I am not sure why your configuration changed when moving from Qt 5.4 to Qt 5.6. There might have been something in your kit configuration for 5.4 (if you are using Qt Creator) which identified these subdirectories which didn't get updated when you moved.
    Last edited by d_stranz; 11th April 2016 at 21:36.

  4. The following user says thank you to d_stranz for this useful post:

    gig-raf (11th April 2016)

  5. #4
    Join Date
    Jun 2012
    Posts
    38
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: include "QDialog" etc not found after upgrade from 5.4 to 5.6

    Thanks mate! is it not a bad idea to update the pro file manually. I mean I work on my projects on two different computers with different setup, hence I use qmake -project every day.

    I will check my qtcreator to see if I have variable pointing to the old directories.

    cheers!

  6. #5
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: include "QDialog" etc not found after upgrade from 5.4 to 5.6

    I'm not really a Qt Creator / qmake user; I work mainly in Visual Studio. There, I can specify include and library paths using environment variables: $(QTDIR)/include, etc. I would be surprised if you can't do the same thing in a .pro file. This would let you move the same project to different computers and it would work the same if you have the same environment variable on each system pointing to the correct place.

  7. The following user says thank you to d_stranz for this useful post:

    gig-raf (12th April 2016)

  8. #6
    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: include "QDialog" etc not found after upgrade from 5.4 to 5.6

    Quote Originally Posted by d_stranz View Post
    In your .pro file, you should be specifying additional include paths <QT_DIR>/include, <QT_DIR>/include/QtCore, <QT_DIR>/include/QtWidgets, etc. where <QT_DIR> is the path to your Qt installation (or an environment variable that says the same thing).
    That should not be necessary as qmake knows which path its Qt was installed in.

    All examples so far were headers from QtWidgets, maybe the QT variable in the .pro file is missing the "widgets" module?

    Cheers,
    _

  9. The following user says thank you to anda_skoa for this useful post:

    gig-raf (12th April 2016)

  10. #7
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: include "QDialog" etc not found after upgrade from 5.4 to 5.6

    maybe the QT variable in the .pro file is missing the "widgets" module?
    Yes, better solution.

  11. The following user says thank you to d_stranz for this useful post:

    gig-raf (12th April 2016)

  12. #8
    Join Date
    Jun 2012
    Posts
    38
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: include "QDialog" etc not found after upgrade from 5.4 to 5.6

    Thanks helping out here!

    I agree that putting in the QT += widgets in my pro file will partially solve the problem. But I never had to do this with the QT5.4 setup I had before.

    I thought the qmake -project would detect what qt libs I need and dynamically create the pro file for me. It is quite handy and safes me lots of time when moving between my development environments (Which are not identical).

    cheers!

  13. #9
    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: include "QDialog" etc not found after upgrade from 5.4 to 5.6

    Quote Originally Posted by gig-raf View Post
    I agree that putting in the QT += widgets in my pro file will partially solve the problem. But I never had to do this with the QT5.4 setup I had before.
    Than this worked by accident, qmake requires to know which modules to use for both the include paths and the libraries to link to and "widgets" is required for QtWidgets since 5.0.

    Adding "widgets" is one of the things that need to be done when porting from Qt4 to Qt5, as QtWidgets was split from QtGui into its own module.

    Quote Originally Posted by gig-raf View Post
    I thought the qmake -project would detect what qt libs I need and dynamically create the pro file for me.
    No, I think it only detects the sources and headers.

    Quote Originally Posted by gig-raf View Post
    It is quite handy and safes me lots of time when moving between my development environments (Which are not identical).
    Then it might be worth considering always using the same build system or using something that can generate input for all required build systems.
    E.g. qmake can not only generate Makefiles, it can also generate visual studio project files.

    CMake has even more output generators.

    Cheers,
    _

  14. The following user says thank you to anda_skoa for this useful post:

    gig-raf (12th April 2016)

  15. #10
    Join Date
    Jun 2012
    Posts
    38
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: include "QDialog" etc not found after upgrade from 5.4 to 5.6

    Thanks guys. I can not thank you enough for the help.

    You are right, I most completely starred myself blind on this problem. Of course I have to update the pro files and add in my include and QT libs manually. I was so sure that qmake -project would do that for me that I completely ruled it out.

    So when I removed the pro file and setup the project again things stopped working.


    ...I hang my head in shame!

Similar Threads

  1. QButtonBox, QDialog should not close on "Abort" or "Cancel"
    By HappyCoder in forum Qt Programming
    Replies: 8
    Last Post: 10th September 2015, 14:10
  2. QML: module "QtQuick.Controls" plugin "qtquickcontrolsplugin" not found on iOS
    By ChristianH in forum Installation and Deployment
    Replies: 0
    Last Post: 22nd August 2015, 18:53
  3. Replies: 32
    Last Post: 26th August 2012, 00:10
  4. "Cannot run program "C:\Qt\4.3.3\bin\qmake": file not found
    By PeteH in forum Installation and Deployment
    Replies: 1
    Last Post: 7th February 2009, 01:48
  5. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 20:05

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.