When I try running a Qt application with the following main.cpp file:

#include <QApplication>
#include "ui_checkabder.h"
#include <QDialog>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Ui::CheckAbder ui;
QDialog *dialog = new QDialog;
ui.setupUi(dialog);
dialog-&gt;show();
return app.exec();
}

I get the following errors:

c:/QtSDK/Desktop/Qt/4.7.3/mingw/lib/libqtmaind.a(qtmain_win.o):-1: In function `WinMain@16':

c:/ndk_buildrepos/qt-desktop/src/winmain/qtmain_win.cpp:131: error: undefined reference to qMain(int, char **)

:-1: error: collect2: ld returned 1 exit status

And, abder.pro looks like this:

######################################################################
# Automatically generated by qmake (2.01a) Mon Apr 18 09:52:56 2011
######################################################################

TEMPLATE = app
TARGET = 
DEPENDPATH += .
INCLUDEPATH += .

# Input
FORMS += checkabder.ui

How can I solve those errors? Provided that I'm using Qt Creator.

Thanks.

Recommended Answers

All 3 Replies

You should make the title more descriptive - like "Qt linker errors". Also, you will probably have better luck here: http://www.qtforum.org/

You should try adding the following line to the .pro file:

QT       += core gui

Also, you should provide a name in the TARGET field:

TARGET = myexecutable.exe

Thanks for your replies.

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.