Op 1 jul. 2012 14:28 schreef "Loaden" <[email protected]> het volgende:
>
> 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.
Something is wrong with Qt5's build configuration: Qt4 uses the same qtmain
helper lib and that just works. Compare the libraries produced for Qt4 and
msvc with those from Qt5 etc. Chances are the MinGW config is not
right/complete.
Ruben
>>
>>
>> #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
>
>
>
------------------------------------------------------------------------------
> 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
>
------------------------------------------------------------------------------
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