When I tried this<br><a href="http://stackoverflow.com/questions/2139637/hide-console-of-windows-application" target="_blank">http://stackoverflow.com/questions/2139637/hide-console-of-windows-application</a><br><br><ol><li>
<ul><li>replace the following code:</li></ul>
<p><strong>int main(int argc, char <em>argv[])
{
QApplication app(argc, argv);
// your code</em>
}</strong></p>
<p>by</p>
<p><strong>int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, char*, int nShowCmd)
{
int argc = 0;
QApplication app( argc, 0 );</strong></p></li></ol>I havent had console windows, but I cannot close process.<br><br>When I try modified CMakeLists.txt it compile fine (Thanks) but I have had console window :( <br><br>I think it is problem with<br>
<span style="font-family: courier new,monospace;">QObject::killTimers: timers cannot be stopped from another thread</span><br>isnt it?<br>I dont know how to disable it... I dont use timers or threads...<br><br><br><div class="gmail_quote">
2011/4/27 Michael Jackson <span dir="ltr"><<a href="mailto:mike.jackson@bluequartz.net">mike.jackson@bluequartz.net</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">> Las time I had to fight with that, I had to change the name of the "main" function for "WinMain".<br>
<br>
</div>NO, Ignore that. In your CMakeLists.txt file you need the following set of commands to properly find Qt4 and set it up for use:<br>
<br>
# ------------------------------------------------------------------------------<br>
# Qt 4 Section<br>
# ------------------------------------------------------------------------------<br>
# by default only QtCore and QtGui modules are enabled<br>
# other modules must be enabled like this:<br>
IF (WIN32)<br>
SET (QT_USE_QTMAIN TRUE)<br>
ENDIF (WIN32)<br>
<br>
# this command finds Qt4 libraries and sets all required variables<br>
# note that it's Qt4, not QT4 or qt4<br>
FIND_PACKAGE( Qt4 REQUIRED )<br>
# add some useful macros and variables<br>
# (QT_USE_FILE is a variable defined by FIND_PACKAGE( Qt4 ) that<br>
# contains a path to CMake script)<br>
INCLUDE( ${QT_USE_FILE} )<br>
<br>
# Set some Win32 Specific Settings<br>
IF(WIN32)<br>
SET(GUI_TYPE WIN32)<br>
ENDIF(WIN32)<br>
<br>
<br>
add_executable (MyProgram ${GUI_TYPE} ${SRCS})<br>
TARGET_LINK_LIBRARIES(MyProgram ${QT_LIBRARIES})<br>
<br>
Cheers<br>
___________________________________________________________<br>
Mike Jackson <a href="http://www.bluequartz.net" target="_blank">www.bluequartz.net</a><br>
Principal Software Engineer <a href="mailto:mike.jackson@bluequartz.net">mike.jackson@bluequartz.net</a><br>
BlueQuartz Software Dayton, Ohio<br>
<div><div></div><div class="h5"><br>
On Apr 27, 2011, at 9:10 AM, Cyrille Faucheux wrote:<br>
<br>
><br>
><br>
> But it was a long time ago, and I was working with GTK...<br>
><br>
> Take a look at that: <a href="http://stackoverflow.com/questions/2139637/hide-console-of-windows-application" target="_blank">http://stackoverflow.com/questions/2139637/hide-console-of-windows-application</a><br>
><br>
> Good luck<br>
> Cyrille<br>
><br>
> Le 27/04/2011 14:46, G G a écrit :<br>
>> When I add WIN32, as you wrote<br>
>><br>
>> ADD_EXECUTABLE( Application WIN32 ${SRCS} ${UI_SRCS} ${RCC_SRCS})<br>
>><br>
>> then when I compile solution I get<br>
>><br>
>> Error 1 error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup MSVCRT.lib Application<br>
>> Error 2 fatal error LNK1120: 1 unresolved externals C:\DP-ITK-APPS\src\my_test\bin\Release\Application.exe Application<br>
>><br>
>> I have set window subsystem acording this<br>
>> <a href="http://bobobobo.wordpress.com/2008/01/29/error-lnk2019-error1error-lnk2019-unresolved-external-symbol-_main-referenced-in-function-___tmaincrtstartupmsvcrtdlib/" target="_blank">http://bobobobo.wordpress.com/2008/01/29/error-lnk2019-error1error-lnk2019-unresolved-external-symbol-_main-referenced-in-function-___tmaincrtstartupmsvcrtdlib/</a><br>
>><br>
>> (I think, that new solution is hasnt to be created?)<br>
>><br>
>><br>
>><br>
>> 2011/4/27 G G <<a href="mailto:greenlander1986@gmail.com">greenlander1986@gmail.com</a>><br>
>> Thank you, I tried it ;)<br>
>><br>
>><br>
>> 2011/4/27 Michael Jackson <<a href="mailto:mike.jackson@bluequartz.net">mike.jackson@bluequartz.net</a>><br>
>> In your add_executable call in your cmakelists.txt file you need to to<br>
>> set the GUI type to win32. Look at the documentation for cmake to get<br>
>> an idea of what you should write.<br>
>><br>
>> Mike Jackson<br>
>> <a href="http://Www.bluequartz.net" target="_blank">Www.bluequartz.net</a><br>
>><br>
>> On Wednesday, April 27, 2011, G G <<a href="mailto:greenlander1986@gmail.com">greenlander1986@gmail.com</a>> wrote:<br>
>> > I have tried it, but I ran console window again :(<br>
>> ><br>
>> > 2011/4/27 G G <<a href="mailto:greenlander1986@gmail.com">greenlander1986@gmail.com</a>><br>
>> ><br>
>> > Thank you very much, I will try it :)<br>
>> > Do you know some article about it? I wrote some thesis and it would be nice, if I have some reference for it...<br>
>> ><br>
>> > 2011/4/27 Lodron, Gerald <<a href="mailto:Gerald.Lodron@joanneum.at">Gerald.Lodron@joanneum.at</a>><br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> > Qt runs only in console mode, if you want to hide console<br>
>> > you can write a bat file which starts the exe like this:<br>
>> ><br>
>> > start MyPropgram.exe<br>
>> ><br>
>> > Then the program does not wait for the return value of the<br>
>> > MyProgram.exe console<br>
>> > best regards<br>
>> ><br>
>> ><br>
>> > Von: <a href="mailto:vtkusers-bounces@vtk.org">vtkusers-bounces@vtk.org</a><br>
>> > [mailto:<a href="mailto:vtkusers-bounces@vtk.org">vtkusers-bounces@vtk.org</a>] Im Auftrag von G G<br>
>> > Gesendet:<br>
>> > Mittwoch, 27. April 2011 12:57<br>
>> > An: <a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a><br>
>> > Betreff:<br>
>> > [vtkusers] QT + VKT + ITK + VS2008<br>
>> ><br>
>> ><br>
>> > Hi I have some project with QT+VTK+ITK and I compile it in Visual<br>
>> > Studio 2008. I create solution with CMake. It works fine. But I compile it and<br>
>> > run. When I run it, I have GUI window and console window. So I have question.<br>
>> > How to disable console window?<br>
>> ><br>
>> > I think, that it is because of CMake, but<br>
>> > I dont know very well.<br>
>> > I tried to used this<br>
>> > <a href="http://www.qtforum.org/article/18473/tutorial-for-using-qt-with-vtk.html" target="_blank">http://www.qtforum.org/article/18473/tutorial-for-using-qt-with-vtk.html</a><br>
>> > But<br>
>> > when I tried to compile it, it gave me many errors...<br>
>> > Do you know some<br>
>> > complete progress, how to compile it?<br>
>> > Or how to disable console<br>
>> > window?<br>
>> ><br>
>> > I dont have console window because of it get me qWarning<br>
>> ><br>
>> ><br>
>> > QObject::killTimers: timers cannot be stopped from another<br>
>> > thread<br>
>> ><br>
>> > when I exit application from console window.<br>
>> > When I exit<br>
>> > application from GUI console window freeze :(<br>
>> ><br>
>> > Thank you all for<br>
>> > help<br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>><br>
>> --<br>
>> _________________________________________________________<br>
>> Mike Jackson <a href="mailto:mike.jackson@bluequartz.net">mike.jackson@bluequartz.net</a><br>
>> BlueQuartz Software <a href="http://www.bluequartz.net" target="_blank">www.bluequartz.net</a><br>
>> Principal Software Engineer Dayton, Ohio<br>
>><br>
>><br>
>><br>
>> _______________________________________________<br>
>> Powered by<br>
>> <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>><br>
>><br>
>> Visit other Kitware open-source projects at<br>
>> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>><br>
>><br>
>> Please keep messages on-topic and check the VTK FAQ at:<br>
>> <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
>><br>
>><br>
>> Follow this link to subscribe/unsubscribe:<br>
>><br>
>> <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
><br>
> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</div></div></blockquote></div><br>