problem compiling QT3 app (cygwin)

Simon Rutishauser simon.rutishauser at web.de
Thu Aug 19 09:18:19 CEST 2004


Hello,
you need to make some changes to your code:

app.setMainWidget requires a Widget�* thus:

#include <qapplication.h>
#include <qmainwindow.h>

int main(int argc, char **argv)
{
  QApplication app(argc, argv);
  QMainWindow* window = new QMainWindow();
  app.setMainWidget(window);
  window->show();
  return app.exec();
}

works correctly.

Simon

On Thu, Aug 19, 2004 at 04:07:55AM +0000, Joe Moore wrote:
> #include <qapplication.h>
> #include <qmainwindow.h>
> 
> int main(int argc, char **argv)
> {
>   QApplication app(argc, argv);
>   QMainWindow window();
>   app.setMainWidget(window);
>   window.show();
>   return app.exec();
> }
> 
> 
> // end 
> 
> I used the following command line to compile:
> 
> 
> g++ -o qt1 qt1.cpp -I$QTDIR/include -L$QTDIR/lib -lqt
> 
> I got back the following .. 
> 
> 
> qt1.cpp: In function `int main(int, char**)':
> qt1.cpp:9: error: no matching function for call to `QApplication::setMainWidget
>    (QMainWindow (&)())'
> /opt/qt/3.2/include/qapplication.h:120: error: candidates are: virtual void
>    QApplication::setMainWidget(QWidget*)
> qt1.cpp:10: error: request for member `show' in `window', which is of
>    non-aggregate type `QMainWindow ()()'
> 
> Am I missing something? 
> 
> 
> 
> _______________________________________________
> kde-cygwin mailing list
> kde-cygwin at kde.org
> https://mail.kde.org/mailman/listinfo/kde-cygwin
> 

-- 


More information about the kde-cygwin mailing list