Unsolved building and running qt project in cli with VS 2015
-
Hi,
I have written a sample helloworld project for qt with visual studio 2015. The project has only one file main.cpp and
for that I have written *.pro filehelloworld ---- helloworld.pro ---- main.cpp
To build and run above project with qmake and VS, I have set below config in command prompt.
set QTDIR="C:\Qt\Qt5.12.0\" set PATH=%PATH%;%QTDIR%\5.12.0\msvc2017_64\bin;"C:\Program Files (x86)\Microsoft Visual Studio\2015\VC\bin" set QMAKESPEC=win32-msvc
Now when I run "qmake", it generates Makefiles. However running make file says no such command as below
C:\Qt-Workspace\helloworld>make 'make' is not recognized as an internal or external command, operable program or batch file.
Can any one tell me what is the problem here? Is it the right way to build and run projects with Visual Studio using command line?
Directory of C:\Qt-Workspace\helloworld 01/10/2019 07:43 PM <DIR> . 01/10/2019 07:43 PM <DIR> .. 01/10/2019 07:43 PM 216 .qmake.stash 01/10/2019 07:43 PM <DIR> debug 01/03/2019 06:27 PM 63 helloworld.pro 01/03/2019 07:00 PM 296 main.cpp 01/10/2019 07:43 PM 30,569 Makefile 01/10/2019 07:43 PM 26,512 Makefile.Debug 01/10/2019 07:43 PM 26,447 Makefile.Release 01/10/2019 07:43 PM <DIR> release 6 File(s) 84,103 bytes 4 Dir(s) 8,740,945,920 bytes free C:\Qt-Workspace\helloworld>
Thanks
-
Hi
Do you open the Visual studio command prompt for this ?
else you need to run
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\vcvarsx86_amd64.bat"
or similar to setup paths. -
@ravi2k18 said in builing and running qt project in cli with VS 2015:
C:\Qt-Workspace\helloworld>make
there is no 'make' on windows at all. It's nmake for MSVC and mingw32-make for MinGW.
-
I am running my test program in Visual studio's Developer command prompt. Even though it says
'make' is not recognized as an internal or external command, operable program or batch file.
If Visual studio does not have make command support, how can we build project with Makefile generated by qmake?
thanks....
-
@ravi2k18
hi
as @Christian-Ehrlicher says its called nmake :) -
I opened the VS command prompt and set the Qt variables as below
set QTDIR="C:\Qt\Qt5.12.0\" set PATH=%PATH%;%QTDIR%\5.12.0\msvc2017_64\bin; set QMAKESPEC=win32-msvc
and while running nmake command I get below error.
C:\Qt-Workspace\helloworld>nmake Microsoft (R) Program Maintenance Utility Version 14.00.24210.0 Copyright (C) Microsoft Corporation. All rights reserved. "C:\Program Files (x86)\Microsoft Visual Studio\2015\VC\BIN\nmake.exe" -f Makefile.Release Microsoft (R) Program Maintenance Utility Version 14.00.24210.0 Copyright (C) Microsoft Corporation. All rights reserved. link /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST:embed /OUT:release\helloworld.exe @C:\Users\RAV~1\AppData\Local\Temp\nm3197.tmp Qt5Widgets.lib(Qt5Widgets.dll) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86' NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2015\VC\BIN\link.EXE"' : return code '0x458' Stop. NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2015\VC\BIN\nmake.exe"' : return code '0x2' Stop. C:\Qt-Workspace\helloworld>
It looks like some 32 and 64 bit mismatch but how to fix? It would be great if you can help me in fixing this.
thanks.......................
-
Hi,
You haven opened a console configured for 32bit builds. Open one for 64bit and you should be good to go.
-
after using x64 bit native VS command prompt, I get below error.
C:\Qt-Workspace\helloworld>nmake Microsoft (R) Program Maintenance Utility Version 14.00.24210.0 Copyright (C) Microsoft Corporation. All rights reserved. "C:\Program Files (x86)\Microsoft Visual Studio\2015\VC\BIN\amd64\nmake.exe" -f Makefile.Release Microsoft (R) Program Maintenance Utility Version 14.00.24210.0 Copyright (C) Microsoft Corporation. All rights reserved. cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc -DUNICODE -D_UNICODE -DWIN32 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DWIN64 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG -I. -I..\..\Qt\Qt5.12.0\5.12.0\msvc2017_64\include -I..\..\Qt\Qt5.12.0\5.12.0\msvc2017_64\include\QtWidgets -I..\..\Qt\Qt5.12.0\5.12.0\msvc2017_64\include\QtGui -I..\..\Qt\Qt5.12.0\5.12.0\msvc2017_64\include\QtANGLE -I..\..\Qt\Qt5.12.0\5.12.0\msvc2017_64\include\QtCore -Irelease -I\include -I..\..\Qt\Qt5.12.0\5.12.0\msvc2017_64\mkspecs\win32-msvc -Forelease\ @C:\Users\SHARDU~1\AppData\Local\Temp\nmF305.tmp main.cpp link /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST:embed /OUT:release\helloworld.exe @C:\Users\RAV~1\AppData\Local\Temp\nmF817.tmp LINK : fatal error LNK1158: cannot run 'rc.exe' NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2015\VC\BIN\amd64\link.EXE"' : return code '0x486' Stop. NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2015\VC\BIN\amd64\nmake.exe"' : return code '0x2' Stop. C:\Qt-Workspace\helloworld>
is set QMAKESPEC=win32-msvc correct for x64 ? or what could be the issue here?
thanks.......
-
What happens if you call
rc.exe
directly in your command prompt ?If not found, then search your hard drive for it.
-
hi @SGaist
As I did not have rc.exe in my system
I had to reinstall(Modify) VS 2015 using offline installer by selecting
Windows and Web Development -> Universal Windows App Development Tools -> Tools (1.4.1) and Windows 10 SDK (10.0.14393)
Once done I do not see above error on nmake and my compilation went successful.
However running the generated executable helloworld.exe I get below run-time errorThe Application was Unable to Start Correctly (0xc000007b)
What could be the cause and fix for this issue?
thanks...
-
You have to modify your prompt PATH environment variable to also point to where your Qt dll's can be found.
-
@ravi2k18 said in builing and running qt project in cli with VS 2015:
0xc000007b
Looks like the program has a 32bit/64bit DLL mismatch. Find more here: https://stackoverflow.com/questions/28299246/0xc000007b-error
The accepted answer there uses Process Monitor to watch the loaded DLLs