Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

MSVC Error but MinGW Work



  • Hello everyone,
    I have a problem I'm just a Hello World. Everything is fine if I compile with a Kit MinGW 32, I change for a Kit MSVC2017 x64 and boom

    main.cpp:11: erreur : no matching member function for call to 'resize'
    D:\Programmes\Qt\5.11.2\msvc2017_64\include\QtWidgets\qwidget.h:837: candidate function not viable: no known conversion from 'QPushButton' to 'QWidget' for object argument
    D:\Programmes\Qt\5.11.2\msvc2017_64\include\QtWidgets\qwidget.h:493: candidate function not viable: requires 1 argument, but 2 were provided
    main.cpp:13: erreur : cannot initialize object parameter of type 'QWidget' with an expression of type 'QPushButton'
    

    The msvc compilers were not automatically detected I had to put the path to the hand (probably because I did not install it in the default folder if a path variable can solve the problem I'm interested in).

    D:\Programmes\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\bin\Hostx64\x64\cl.exe
    

    The main

    #include <QApplication>
    #include <QPushButton>
    
    int main(int argc, char *argv[])
    {
        QApplication app(argc, argv);
        QPushButton hello("Hello world!");
        hello.resize(200, 60);
        hello.show();
        return app.exec();
    }
    

    The Pro file

    SOURCES      = main.cpp
    QT += widgets
    

    I can't make simpliest sample


  • Lifetime Qt Champion

    Are you really sure the testcase is exactly what you're trying to compile? Since you don't have 11 lines in your example whereas the error occurs at line 13 ...


Log in to reply