[Qt-creator] mingw-w64-crt/crt/crt0_c.c:18: undefined reference to `WinMain'

Orgad and Raizel Shaneh orgads at gmail.com
Sun Jun 24 07:36:22 CEST 2012


On Sun, Jun 24, 2012 at 6:32 AM, Loaden <loaden at gmail.com> wrote:

> Hi, all!
> I just try to cross compile for Windows, in final, I can't solved a link
> error, It's looks strange.
> https://codereview.qt-project.org/#change,29231
>
> linking qtcreator.exe
>> linking libQt4ProjectManager.dll
>> /usr/bin/x86_64-w64-mingw32-g++ -O2 -Wall -W
>> /home/loaden/qpSOFT/Projects/QtCreator/build/windows-x64-mingw64-release/.obj/qtcreator/GeneratedFiles/qtcreator/moc_qtsingleapplication.o
>> /home/loaden/qpSOFT/Projects/QtCreator/build/windows-x64-mingw64-release/.obj/qtcreator/GeneratedFiles/qtcreator/moc_qtlocalpeer.o
>> /home/loaden/qpSOFT/Projects/QtCreator/build/windows-x64-mingw64-release/.obj/qtcreator/src/shared/qtsingleapplication/qtsingleapplication.o
>> /home/loaden/qpSOFT/Projects/QtCreator/build/windows-x64-mingw64-release/.obj/qtcreator/src/shared/qtlockedfile/qtlockedfile_win.o
>> /home/loaden/qpSOFT/Projects/QtCreator/build/windows-x64-mingw64-release/.obj/qtcreator/src/shared/qtlockedfile/qtlockedfile.o
>> /home/loaden/qpSOFT/Projects/QtCreator/build/windows-x64-mingw64-release/.obj/qtcreator/src/app/main.o
>> /home/loaden/qpSOFT/Projects/QtCreator/build/windows-x64-mingw64-release/.obj/qtcreator/src/shared/qtsingleapplication/qtlocalpeer.o
>> -Wl,-subsystem,windows -o
>> /home/loaden/qpSOFT/Projects/QtCreator/build/windows-x64-mingw64-release/bin/qtcreator.exe
>> -Wl,-rpath,$ORIGIN/../lib/qtcreator
>> -L/home/loaden/qpSOFT/Projects/MingwQt-x64/qtbase/lib
>> -L/home/loaden/qpSOFT/Projects/QtCreator/build/windows-x64-mingw64-release/bin
>> -L/home/loaden/qpSOFT/Projects/QtCreator/build/windows-x64-mingw64-release/bin
>> -lqtmain -lkernel32 -lgdi32 -lshell32 -lQtCore5 -lQtGui5 -lQtNetwork5
>> -lQtWidgets5 -lQtConcurrent5 -luser32 -liphlpapi -lws2_32 -lQtScript5
>> -llibExtensionSystem -llibUtils
>> */usr/lib/gcc/x86_64-w64-mingw32/4.6/../../../../x86_64-w64-mingw32/lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o):
>> In function `main':
>> /build/buildd/mingw-w64-2.0.1/build/x86_64-w64-mingw32/all/mingw-w64-crt/../../../../mingw-w64-crt/crt/crt0_c.c:18:
>> undefined reference to `WinMain'
>> collect2: ld returned 1 exit status*
>>
>> ERROR: Process failed with exit code 1.
>> ERROR: The following products could not be built: GLSLEditor, Git,
>> styleplugin, QmlJSEditor, ClassView, QtComponents, CppEditor,
>> QmlProjectManager, Macros, SharedContent, qtcdebugger, VcsBase,
>> CMakeProjectManager, Welcome, Designer, Help, ResourceEditor,
>> GenericProjectManager, AnalyzerBase, RemoteLinux, zeroconf, Valgrind,
>> Bookmarks, QmlProfiler, Todo, QmlEditorWidgets, qtcreator_process_stub,
>> mdnssd, qtpromaker, qtcreator_ctrlc_stub, qtcreator, GLSL.
>> Build failed.
>>
>>
> I look into mingw-w64's *mingw-w64-crt/crt/crt0_c.c:
> *
>>
>> /**
>>  * This file has no copyright assigned and is placed in the Public Domain.
>>  * This file is part of the w64 mingw-runtime package.
>>  * No warranty is given; refer to the file DISCLAIMER.PD within this
>> package.
>>  */
>>
>> #include <windows.h>
>>
>> extern HINSTANCE __mingw_winmain_hInstance;
>> extern LPSTR __mingw_winmain_lpCmdLine;
>> extern DWORD __mingw_winmain_nShowCmd;
>>
>> /*ARGSUSED*/
>> int main (int     __UNUSED_PARAM(flags),
>>       char ** __UNUSED_PARAM(cmdline),
>>       char ** __UNUSED_PARAM(inst))
>> {
>>   return (int) WinMain (__mingw_winmain_hInstance, NULL,
>>             __mingw_winmain_lpCmdLine, __mingw_winmain_nShowCmd);
>> }
>>
> It's should never happen, I mean we have owner main entry.
> Why we call mingw-w64's main function as entry?
> Any comments?
>
> --
> Please don't ask where I come from, It's a shame!
> Best Regards
> Yuchen
>
>
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qt-creator
>
>
Hi,

Didn't this change <https://codereview.qt-project.org/29232> help? It looks
like you're missing libqtmain.

- Orgad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20120624/2e7587d8/attachment.html>


More information about the Qt-creator mailing list