PDA

View Full Version : How to compile Qt with Microsoft Visual Studio



citix
3rd December 2013, 10:33
I created a Qt programme, I can compile it without problem manuelly with Visual Studio (using Add-In) but when I try to compile it with coding I have a problem. The problem is

C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppComm on.targets(151,5): error MSB6006: "cmd.exe" exited with code 3. [C:\output\Deneme\Qt\projectQt.vcxproj]
Done Building Project "C:\output\Deneme\Qt\projectQt.vcxproj" (default targets) -- FAILED.

Build FAILED.

"C:\output\Deneme\Qt\projectQt.vcxproj" (default target) (1) ->
(CustomBuild target) ->
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppComm on.targets(151,5): error MSB6006: "cmd.exe" exited with code 3. [C:\output\Deneme\Qt\projectQt.vcxproj]

0 Warning(s)
1 Error(s)
How can I solve the problem, please help me…

zgulser
3rd December 2013, 12:21
What do you mean by coding?

citix
3rd December 2013, 13:03
compile the software with using other c++ project (inside).

citix
3rd December 2013, 21:46
anyone can help me?

stampede
3rd December 2013, 21:52
What do you mean by "compile the software with using other c++ project (inside)" ? Linking to external library ?

citix
4th December 2013, 09:57
I am tring to compile my Qt program with another C++ program.

stampede
4th December 2013, 10:08
Sorry you have to be more precise. Where is this another C++ program ? Inside your project folder ? More details needed.
This sentence can be understood also as "I am trying to compile my Qt program with my own compiler".

citix
4th December 2013, 10:39
I have 2 project one of them is Qt project and the other one is C++ project. Qt project can compile and run without any problem manuelly using Visual Studio Add-In. But I want to compile and run the Qt project with the other C++ project.
for example, using this code inside the C++ project.

system(command.c_str());

d_stranz
5th December 2013, 02:17
So, if I understand what you are saying, you are not trying to compile your Qt program using a plain C++ program, you are trying to run it from the C++ program, is that right?

You have "projectQt.exe" somewhere, and you want your C++ program to do something like this:



static std::string runQtProgramCommand = "C:\\output\\Deneme\\Qt\\projectQt.exe";

int main( int argc, char * * argv )
{
return system( runQtProgramCommand.c_str() );
}


In order for this to work, you need to have the environment for the Qt program configured correctly:

1 - All of the Qt DLLs required by projectQt.exe have to be in the same directory as projectQt.exe (or have to be located in your $PATH environment variable)
2 - If you are using Qt 5.x, then you have to have qwindows.dll in a subdirectory .\platforms under the directory where projectQt.exe lives. See this thread. (http://www.qtcentre.org/threads/57024-Microsoft-Visual-C-Runtime-Library-problem-while-running-app-outside-QtCreator)
3 - Anything else that projectQt.exe depends on also has to be in the projectQt.exe directory or on the $PATH.

citix
5th December 2013, 08:39
Thanks for codes for running. (" system( runQtProgramCommand.c_str() ); ") I found it before you said but I cant find compiling codes. How can I compile my Qt program? Anyone have any idea?

aamer4yu
5th December 2013, 09:52
You will need to modify some sort of pre build steps in the Visual Studio.. or add the compiling steps for Qt app as dependencies.

I am not much aware of the Visual studio project files... so if you know, add some pre build step for the Qt app

citix
5th December 2013, 11:26
I dont know it so I need helps....