[Development] ActiveQt AxServer with CMake

Thomas Sondergaard ts at medical-insight.com
Thu Feb 13 14:21:07 CET 2014


On 2014-02-13 13:47, Fricot, Daniel wrote:
> Rob,
> Your cmake snippet is basically what I do in my build.
> Idc is the problem. This gives the " Timers can only be used with
> threads started with QThread" error.
> After some more playing around, I noticed something. If I place a
> breakpoint in the beginning of my main, I got the following stacktrace
> (build with cmake, without IDL commands):
>      0    main                 main.cpp    44     0x81ea7
>      1    __tmainCRTStartup    crtexe.c    536    0xafad9
>      2    mainCRTStartup       crtexe.c    377    0xafc1d
>      3    BaseThreadInitThunk  kernel32           0x76f8336a
>      4    __RtlUserThreadStart ntdll              0x77979f72
>      5    _RtlUserThreadStart  ntdll              0x77979f45
> If I do the same with something I build with qmake (which does the IDL
> commands for you), I got:
>      0    main                 main.cpp           252    0x1002ad6
> *1    WinMain              qaxservermain.cpp  260    0x101bdb1*
>      2    __tmainCRTStartup    crtexe.c           528    0x102fb62
>      3    WinMainCRTStartup    crtexe.c           377    0x102f92d
>      4    BaseThreadInitThunk  kernel32                  0x76f8336a
>      5    __RtlUserThreadStart ntdll                     0x77979f72
>      6    _RtlUserThreadStart  ntdll                     0x77979f45
> (Note that the main.cpp in the two stacktraces are two different files,
> so don’t mind the difference in line numbers in main.cpp)
> As you can see, in the activeqt server, build with qmake, the main is
> called from WinMain in qaxservermain.cpp. I don’t know if this is the
> result of the IDL commands (in which case, the cmake build obviously
> does not have the WinMain in the stacktrace) or this should also be in
> the stacktrace of the cmake build, even before running the IDL commands?
> Thanks,
> Daniel


It looks like you are building a .exe. Do you have WIN32 in your 
add_executable statement? qaxservermain.cpp (in the Qt 4.8 source I have 
lying around) provides a WinMain() that will call ::main().

Regards,
Thomas





More information about the Development mailing list