Error: undefined reference to `qMain(int, char**)'
-
When I compiled my project,Qt Creator showed this error.I googled it,and many people say it's because of losing main function.But I actually have main function.
main.cpp
@#include<QApplication>
#include"dialog.h"int main(int argc, char *argv[])
{
QApplication app(argc, argv);
dialog d;
d.show();return app.exec();
}
@.pro
@TEMPLATE = app
TARGET = custombutton_mine
HEADERS +=
mybutton.h
dialog.hSOURCES +=
mybutton.cpp
dialog.cpp
main.cppFORMS +=
dialog.ui@ -
I'm getting the same error at compile time. Tried checking entire code line by line , yet can't figure it out.
-
@JadeN001
How you get the same error "at run time" given that it's a compile-time error message? -
What OS, what Qt version, which compiler?
What do you have in your project file (.pro
)? -
@kshegunov OS:windows
qt version : Qt 5.10.1 (MSVC 2015, 32 bit).
i am using sub-project for plugin implementation so my main pro file is containing only
TEMPLATE = subdirsSUBDIRS =
Server
pluginbut i think problem is in my plugin project which is sub project of my main project.
TEMPLATE = lib CONFIG += plugin QT += widgets INCLUDEPATH += ../mainwindow HEADERS += \ broadcast_plugin.h SOURCES += \ broadcast_plugin.cpp TARGET = $$qtLibraryTarget(broadcast_plugin) DESTDIR = ../plugins
-
@kshegunov OS:windows
qt version : Qt 5.10.1 (MSVC 2015, 32 bit).
i am using sub-project for plugin implementation so my main pro file is containing only
TEMPLATE = subdirsSUBDIRS =
Server
pluginbut i think problem is in my plugin project which is sub project of my main project.
TEMPLATE = lib CONFIG += plugin QT += widgets INCLUDEPATH += ../mainwindow HEADERS += \ broadcast_plugin.h SOURCES += \ broadcast_plugin.cpp TARGET = $$qtLibraryTarget(broadcast_plugin) DESTDIR = ../plugins
@JadeN001 said in Error: undefined reference to `qMain(int, char**)':
but i think problem is in my plugin project which is sub project of my main project.
You can know - it's a linker error and you should check the build output. Provide the relevant project file for the binary that fails to link.
-
@JadeN001 said in Error: undefined reference to `qMain(int, char**)':
but i think problem is in my plugin project which is sub project of my main project.
You can know - it's a linker error and you should check the build output. Provide the relevant project file for the binary that fails to link.
@kshegunov yeah thanks..i will go through it.