PDA

View Full Version : how to avoid command prompt while reunning EXE ?



rajeshs
25th March 2008, 07:23
Hi all,

I created GUI Application Exe . If I run the exe . One command prompt is comming with

this in Windows. How to avoid this Command prompt window ?

yogeshm02
25th March 2008, 07:44
If you are using MinGW then refer to
http://www.mingw.org/docs.shtml
http://www.allegro.cc/forums/print-thread/594895

rajeshs
25th March 2008, 09:04
I am using VS compiler

wysota
25th March 2008, 09:20
Do you use a .pro file? If so, remove CONFIG+=console from it. If not, access your Qt VS integration module and disable the console there.

rajeshs
25th March 2008, 11:06
I am using cmake to compile my application .

ChristianEhrlicher
25th March 2008, 12:05
Then read cmake ml or documentation :)

http://www.cmake.org/pipermail/cmake/2008-March/020572.html

rajeshs
25th March 2008, 12:41
I added WIN32 in ADD_EXECUTABLE of CMake


But I am getting the following error,


error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup


:)

ChristianEhrlicher
25th March 2008, 12:51
Did you forgot to add QT_QTMAIN_LIBRARY to target_link_libraries ?

jpn
25th March 2008, 12:52
Make clean (or at least delete main.o) and rebuild. Sources haven't changed so you need to force a rebuild by hand.

rajeshs
26th March 2008, 03:49
I did clean and then build ,still i am getting same error.

I am suspecting my main implementation,

i am using main like below,


int main(int argc,char* argv[])
{
QApplication myApp(argc,argv);

MyMainWindow mainWnd;

mainWnd.show();

return myApp.exec();
}

MyMainWindow is derived from QMainWindow.

Is my main implementation correct ?

wysota
26th March 2008, 08:10
Yes, it's fine. Your project file has to be incorrect.

rajeshs
26th March 2008, 08:19
Now I solved by adding following Lines in the CMakeLists.txt File.

IF(WIN32)
LINK_LIBRARIES(
${QT_QTMAIN_LIBRARY}
)
ENDIF(WIN32)

IF(WIN32)
ADD_DEFINITIONS(-DQT_DLL)
ENDIF(WIN32)


and then ,

WIN32 in ADD_EXUCUTABLE

ChristianEhrlicher
26th March 2008, 08:22
No need to add this for WIN32 only. ${QT_QTMAIN_LIBRARY} is just empty on linux and QT_DLL is ignored (why do you need it at all?)