开发者

Program only executes if I run it in Visual Studio

I have been trying to find a solution for this problem but I haven't been able to see/find any answer that correctly solves it.

I coded a program (Qt + OpenCV) that works fine when I run it with Visual Studio, but trying to run the executable it simply does not execute anything. The program doesn't give any error: it just never starts.

I am not sure where to start checking what is happening and why it is not even starting (I could understand lack of libraries, some other error..).

I am basically interested on what are the best way of checking why a program runs when executed from the IDE and not from the executable created. As I said, I was expecting an error message if something was wrong. Any ideas? Any good programming advice regarding 开发者_开发问答how to avoid this problem in the future?

Edit: I forgot to mention that I am coding with a Windows XP machine. It doesn't work in this machine when I try to execute the file. It executes normally on a W7 machine but not in other W7 machine.


The executable will need the QT libraries on the computer that you are running it on. On linux there is command (I think ldd) that will show you what libraries your executable needs. I am not sure about Windows but there should be something similar. At least on a linux computer it will not necessarily give you an error if the QT libraries are missing. The executable just seems to do nothing.


Try copying the executable into the same directory as the .dll files in the Qt 'bin' directory.

If that works then you just need to put the Qt bin directory into your path, or copy the dlls into the windows\system directory


You need not only the correct dlls in your path (best in the application directory), but also the plugins in the correct location. See my answer to the question: Qt dll deployment on windows.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜