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 ?!

Recommended Answers

All 2 Replies

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

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

QApplication qApp(&argc, &argv);

Ooops, got GTK+ mixed up with QT4.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.