954,480 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Qt4 and devcpp

I am trying to use Qt 4.0 with devCpp.

I have a weird error when i try to compile this simple code :

#include <QtGui/QApplication>

int main(int argc, char *argv[])
{
	QApplication qApp(argc, argv);
    
    return qApp.exec();
}


The error is :

10 : no matching function for call to QApplication::QApplication(QApplication*)' 
10 : note : candidates are : 
                              [...]
      note : QApplication::QApplication(int&, char**)


I've never seen that before ! where does it come from ?!

CrazyDieter
Junior Poster
108 posts since Jul 2005
Reputation Points: 11
Solved Threads: 6
 

You had me pretty confused on this one. It seems like qApp is a macro or something (reserved word).

I changed it to:

QApplication a(argc, argv);
    
return a.exec();


and then it worked fine.

David

daviddoria
Posting Virtuoso
1,996 posts since Feb 2008
Reputation Points: 437
Solved Threads: 204
 

I'm pretty sure it has to be like this:

QApplication qApp(&argc, &argv);

Ooops, got GTK+ mixed up with QT4.

gerard4143
Nearly a Posting Maven
2,272 posts since Jan 2008
Reputation Points: 512
Solved Threads: 387
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You