Error LNK2019: unresolved external symbol _main referenced in function _WinMain@16

  • Hi, all!
    I have Qt 5.4.0 for visual studio 2013 32 bit.
    I have Qt add-in 1.2.4.
    I have Visual Studio 2013 Ultimate + Update 4 (12.031101.00)

    I have a simple Qt app.
    .pro file:
    @QT += core gui widgets

    TARGET = splitter_qt_creator
    TEMPLATE = app

    SOURCES += main.cpp@

    main.cpp file:
    @#include <QApplication>
    #include <QSplitter>
    #include <QTextEdit>

    int mian(int argc, char* argv[])
    QApplication a(argc, argv);

    QSplitter* pMainSplitter = new QSplitter;
    return a.exec(&#41;;

    Unfortunately when I try to build the solution, the error appears:
    error LNK2019: unresolved external symbol _main referenced in function _WinMain@16

    I've tried to apply "hot-fix" - remove value related to "/SUBSYSTEM:WINDOWS" from project properties->linker->command line->additonal options.
    but atm the value is not an additional option.
    additional options are:
    "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='' publicKeyToken='...' language='' processorArchitecture=''"

    Who can help me?

  • It seems you create new project as Console application but your code is Win32.

    check it, plz

  • if you mean I should remove QT += core, it doesn't help.

  • Hi, check the name of your main function. You did a mistype

    @int mian(int argc, char* argv[])@

    it's named mian so the linker can not find the main function.

    Best regards Michael

  • Thanks a lot !
    omg, epick fail

  • Banned

    This post is deleted!

Log in to reply