[Cmake] WinMain
Andy Cedilnik
andy.cedilnik at kitware.com
Mon Jun 7 09:33:38 EDT 2004
Hi Nick.
It has to do with another one of those weird things on Windows. When
creating a windows app, you really need function WinMain() and not
main(). For example of that one, look here:
http://public.kitware.com/cgi-bin/cvsweb.cgi/ParaView/GUI/Client/ParaView.cxx?rev=1.110;content-type=text%2Fplain;cvsroot=ParaView
This is the prototype:
int __stdcall WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nShowCmd)
and lpCmdLine holds string with all arguments.
Good luck.
Andy
On Mon, 2004-06-07 at 09:26, Nick Arini wrote:
> Dear CMake users,
>
>
> I am using CMake as the build tool for a GUI application written in Qt
> (on Linux-GCC 3.3).
>
> When I build the application on Windows XP (MSVC++.NET 7.1) it will
> compile just fine with no errors, however when
> I run the app I get the command window showing up as well as the GUI.
> In my main program I am using main().
>
> When I replace the line:
>
> ADD_EXECUTABLE(viewer VIEWER_SRCS)
>
> in my CMakeLists.txt file with this:
>
> ADD_EXECUTABLE(viewer WIN32 VIEWER_SRCS)
>
> however, I get the following linker error:
>
>
> ------ Build started: Project: viewer, Configuration: Release Win32
> ------
>
> Compiling...
> main.cpp
> Linking...
> Creating library Release\viewer.lib and object Release\viewer.exp
> MSVCRT.lib(crtexew.obj) : error LNK2019: unresolved external symbol
> _WinMain at 16 referenced in function _WinMainCRTStartup
> Release\viewer.exe : fatal error LNK1120: 1 unresolved externals
>
> viewer - 2 error(s), 0 warning(s)
>
>
> How do I get rid of the command window without making my code platform
> specific?
>
> I am using version 1.8 patch 3 of CMake.
>
> Thanks and best regards,
More information about the Cmake
mailing list