Here is the verbose log:

> loaden@qpsoft:~/qpSOFT/Projects/Qbs/tests/manual/uic$
> /usr/bin/x86_64-w64-mingw32-g++ -v -m64 -O2 -Wall -W
> /home/loaden/qpSOFT/Projects/Qbs/tests/manual/uic/build/m64-mingw64-release/.obj/ui/bla.o
> -o
> /home/loaden/qpSOFT/Projects/Qbs/tests/manual/uic/build/m64-mingw64-release/ui.exe
> -L/home/loaden/qpSOFT/Projects/BuildQt5-m64/qtbase/lib -lqtmain -lQtCore5
> -lQtGui5
> Using built-in specs.
> COLLECT_GCC=/usr/bin/x86_64-w64-mingw32-g++
> COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-w64-mingw32/4.6/lto-wrapper
> Target: x86_64-w64-mingw32
> Configured with: ../../src/configure --build=x86_64-linux-gnu
> --prefix=/usr --includedir='/usr/include' --mandir='/usr/share/man'
> --infodir='/usr/share/info' --sysconfdir=/etc --localstatedir=/var
> --libexecdir='/usr/lib/gcc-mingw-w64' --disable-maintainer-mode
> --disable-dependency-tracking --prefix=/usr --enable-shared --enable-static
> --disable-multilib --enable-linker-build-id --with-system-zlib
> --libexecdir=/usr/lib --without-included-gettext --libdir=/usr/lib
> --enable-libstdcxx-time=yes --with-tune=generic
> --enable-version-specific-runtime-libs --enable-threads=win32
> --enable-fully-dynamic-string --enable-sjlj-exceptions
> --enable-languages=c,c++,fortran,objc,obj-c++,ada --enable-lto
> --with-plugin-ld --target=x86_64-w64-mingw32
> --with-gxx-include-dir=/usr/include/c++/4.6
> --with-as=/usr/bin/x86_64-w64-mingw32-as
> --with-ld=/usr/bin/x86_64-w64-mingw32-ld
> Thread model: win32
> gcc version 4.6.3 (GCC)
>
> COMPILER_PATH=/usr/lib/gcc/x86_64-w64-mingw32/4.6/:/usr/lib/gcc/x86_64-w64-mingw32/4.6/:/usr/lib/gcc/x86_64-w64-mingw32/:/usr/lib/gcc/x86_64-w64-mingw32/4.6/:/usr/lib/gcc/x86_64-w64-mingw32/
>
> LIBRARY_PATH=/usr/lib/gcc/x86_64-w64-mingw32/4.6/:/usr/lib/gcc/x86_64-w64-mingw32/4.6/../../../../x86_64-w64-mingw32/lib/
> COLLECT_GCC_OPTIONS='-v' '-m64' '-O2' '-Wall' '-Wextra' '-o'
> '/home/loaden/qpSOFT/Projects/Qbs/tests/manual/uic/build/m64-mingw64-release/ui.exe'
> '-L/home/loaden/qpSOFT/Projects/BuildQt5-m64/qtbase/lib' '-shared-libgcc'
> '-mtune=generic' '-march=x86-64'
>  /usr/lib/gcc/x86_64-w64-mingw32/4.6/collect2 -m i386pep -Bdynamic -o
> /home/loaden/qpSOFT/Projects/Qbs/tests/manual/uic/build/m64-mingw64-release/ui.exe
> /usr/lib/gcc/x86_64-w64-mingw32/4.6/../../../../x86_64-w64-mingw32/lib/crt2.o
> /usr/lib/gcc/x86_64-w64-mingw32/4.6/../../../../x86_64-w64-mingw32/lib/crtbegin.o
> -L/home/loaden/qpSOFT/Projects/BuildQt5-m64/qtbase/lib
> -L/usr/lib/gcc/x86_64-w64-mingw32/4.6
> -L/usr/lib/gcc/x86_64-w64-mingw32/4.6/../../../../x86_64-w64-mingw32/lib
> /home/loaden/qpSOFT/Projects/Qbs/tests/manual/uic/build/m64-mingw64-release/.obj/ui/bla.o
> -lqtmain -lQtCore5 -lQtGui5 -lstdc++ -lmingw32 -lgcc_s -lgcc -lmoldname
> -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32
> -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt
> /usr/lib/gcc/x86_64-w64-mingw32/4.6/../../../../x86_64-w64-mingw32/lib/crtend.o
> /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.3/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



2012/7/1 Loaden <[email protected]>

> The 'WinMain' entry function compiled in libmain.a, the issue is:
> mingw-w64 can't find the function, but it is exist.
> Same code can be compilation use MSVC / Linux GCC.
> Only does not work with MinGW-w64.
>
>>
>> #include "qt_windows.h"
>> #include "qbytearray.h"
>> #include "qstring.h"
>> #include "qvector.h"
>>
>> /*
>>   This file contains the code in the qtmain library for Windows.
>>   qtmain contains the Windows startup code and is required for
>>   linking to the Qt DLL.
>>
>>   When a Windows application starts, the WinMain function is
>>   invoked. WinMain calls qWinMain in the Qt DLL/library, which
>>   initializes Qt.
>> */
>>
>> QT_BEGIN_NAMESPACE
>>
>> #if defined(Q_OS_WINCE)
>> extern void __cdecl qWinMain(HINSTANCE, HINSTANCE, LPSTR, int, int &,
>> QVector<char *> &);
>> #else
>> extern void qWinMain(HINSTANCE, HINSTANCE, LPSTR, int, int &,
>> QVector<char *> &);
>> #endif
>>
>> QT_END_NAMESPACE
>>
>> QT_USE_NAMESPACE
>>
>>
>> #if defined(QT_NEEDS_QMAIN)
>> int qMain(int, char **);
>> #define main qMain
>> #else
>> #ifdef Q_OS_WINCE
>> extern "C" int __cdecl main(int, char **);
>> #else
>> extern "C" int main(int, char **);
>> #endif
>> #endif
>>
>> /*
>>   WinMain() - Initializes Windows and calls user's startup function
>> main().
>>   NOTE: WinMain() won't be called if the application was linked as a
>> "console"
>>   application.
>> */
>>
>> #ifdef Q_OS_WINCE
>> int WINAPI WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPWSTR
>> /*wCmdParam*/, int cmdShow)
>> #else
>> extern "C"
>> int APIENTRY *WinMain*(HINSTANCE instance, HINSTANCE prevInstance, LPSTR
>> /*cmdParamarg*/, int cmdShow)
>> #endif
>> {
>>     QByteArray cmdParam =
>> QString::fromWCharArray(GetCommandLine()).toLocal8Bit();
>>
>> #if defined(Q_OS_WINCE)
>>     wchar_t appName[MAX_PATH];
>>     GetModuleFileName(0, appName, MAX_PATH);
>>     cmdParam.prepend(QString(QLatin1String("\"%1\"
>> ")).arg(QString::fromWCharArray(appName)).toLocal8Bit());
>> #endif
>>
>>     int argc = 0;
>>     QVector<char *> argv(8);
>>     qWinMain(instance, prevInstance, cmdParam.data(), cmdShow, argc,
>> argv);
>>
>> #if defined(Q_OS_WINCE)
>>     wchar_t uniqueAppID[MAX_PATH];
>>     GetModuleFileName(0, uniqueAppID, MAX_PATH);
>>     QString uid =
>> QString::fromWCharArray(uniqueAppID).toLower().replace(QLatin1String("\\"),
>> QLatin1String("_"));
>>
>>     // If there exists an other instance of this application
>>     // it will be the owner of a mutex with the unique ID.
>>     HANDLE mutex = CreateMutex(NULL, TRUE, (LPCWSTR)uid.utf16());
>>     if (mutex && ERROR_ALREADY_EXISTS == GetLastError()) {
>>         CloseHandle(mutex);
>>
>>         // The app is already running, so we use the unique
>>         // ID to create a unique messageNo, which is used
>>         // as the registered class name for the windows
>>         // created. Set the first instance's window to the
>>         // foreground, else just terminate.
>>         // Use bitwise 0x01 OR to reactivate window state if
>>         // it was hidden
>>         UINT msgNo = RegisterWindowMessage((LPCWSTR)uid.utf16());
>>         HWND aHwnd = FindWindow((LPCWSTR)QString::number(msgNo).utf16(),
>> 0);
>>         if (aHwnd)
>>             SetForegroundWindow((HWND)(((ULONG)aHwnd) | 0x01));
>>         return 0;
>>     }
>> #endif // Q_OS_WINCE
>>
>>     int result = main(argc, argv.data());
>> #if defined(Q_OS_WINCE)
>>     CloseHandle(mutex);
>> #endif
>>     return result;
>> }
>>
>> 2012/7/1 JonY <[email protected]>
>
>> You are missing main or WinMain in your code.
>>
>
>
>
> --
> Please don't ask where I come from, It's a shame!
> Best Regards
> Yuchen
>
>


-- 
Please don't ask where I come from, It's a shame!
Best Regards
Yuchen
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to