1

Recently, I am using the QtService on linux and it's good, but when I try to run on windows with vs-2010 compiler, is not working on command prompt (is not showing any output and immediately will be finished). I can run this program on Qt Creator console emulator(Application output) and it working when the Run in Terminal is not checked. When I try to run in terminal whether with Qt Creator or in Command prompt, it's not working?

Why it run in Qt creator and not run terminal? What is difference run a program in Qt creator and command prompt in Windows?

softghost
  • 1,167
  • 1
  • 10
  • 16
  • you have to put Qt libraries (QtCore.dll, QtService.dll, etc.) into the directory where you are running your Qt program. – Harshith J.V. Mar 26 '12 at 08:44
  • check the deployment documents - http://qt-project.org/doc/qt-4.8/deployment-windows.html – Harshith J.V. Mar 26 '12 at 09:21
  • I know how to deploy Qt application, and place the needed DLL in folder of executable file. The exact thing for me why I don't use _run in terminal_ is working and when I use _run in terminal_ is not working. This is a technical question about Qt creator. – softghost Mar 26 '12 at 09:43

3 Answers3

2

You can either have mingwm32.dll QtCore.dll and other dependencies on the application's directory (and make sure that you build on Release mode because in Debug mode, DLL-se are much bigger) (this is called Dynamic Linking) or you can static link against Qt libraries so you can have one .exe file and Qt libs are bundled with that binary.

Look here for instructions. But you can always Google it.

milot
  • 1,060
  • 2
  • 8
  • 17
  • tnx, but: first. I have said ,I use msvc-2010 _ second. I know how to deploy Qt application (I am using dependency walker for this). Therefore your answer is not correct. – softghost Mar 26 '12 at 09:40
1

Possibility 1, it is related to current working directory (cwd), you can use a simple Qt function to figure out the difference. On command prompt, the cwd is simply the current working directory (^^), while in Qt Creator it is set up via Projects ->Run Settings->Working directory.
Possibility 2, you're running two different executables??
I see no difference otherwise.

Hai Phaikawl
  • 1,091
  • 8
  • 11
  • I've worked for a long time in Linux and I every time set LD_LIBRARY_PATH to find appropriate library and in Qt Creator you have **Run Environment** to set this variable. But in windows what variable is important? – softghost Mar 26 '12 at 20:39
  • I forget to say this: The executable is not working when I used QtService. – softghost Mar 26 '12 at 20:41
  • But what is the point of setting an environment variable similar to LD_LIBRARY_PATH?? I see no point in doing it since on windows the default and highest priority path is the application directory. The second path is windows/system32. I think those are enough :D – Hai Phaikawl Mar 27 '12 at 12:25
0

I don't know how your Qt kits are set up, but I was recently having a problem similar to this one wherein my Qt program would work if I launched it from the terminal, but I would get runtime errors if I ran it from Qt Creator. I realize this is sort of the opposite of your problem, but most people seem to be answering the question "how do I deploy a Qt app on Windows" rather than what you asked (or what I perceive to be your question anyway), and while solving my problem I found this question of yours but was frustrated that nobody had answered really what you asked.

So, my problem was happening because, in the kit I was using, I had set a PATH, overriding my normal system PATH. As a result, when the program would run it couldn't find all the DLLs it needed. So, to answer your question of what is different, one major thing that can be different is your Environment in your kit in your Qt Creator. In my case it made it so PATH was the difference but I'm sure it could make for more differences as well. See the accepted answer to this post of mine from the problem I'm talking about for detailed instructions on how to get to this Environment section of your kit and edit it. Yeah I answered my own question and accepted my own answer but it was not my intention when I posted the question :P

Hope this is the sort of information you were looking for :^D

23r0c001
  • 151
  • 1
  • 6