i just installed qt creator 5.10 and i opened a simple widget application this is the error that i get even without running the application
:-1: error: Failed to retrieve MSVC Environment from "D:\pograml files\visual studio2\VC\Auxiliary\Build\vcvarsall.bat":
'chcp' is not recognized as an internal or external command,
operable program or batch file.
'wmic' is not recognized as an internal or external command,
operable program or batch file.
i haven't found any solutions for this, if anyone could help me i would be very thankful
When Qt starts, I used to get a list of 10 errors related to MSVC kit because each detected MSVC platform compiler has an Initialization script for setting environment. like:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat x86_amd64
I traced the failure by running all Initialization one by one on same command line (cmd) window; In the beginning I used to run only Initialization for x86_amd64 which runs without errors thus I didn't notice anything wrong. But on same window running Initialization for next compiler " ...\vcvarsall.bat x86_amd64" the error appeared which in my case was something like:
" ..program Files\MySQL\Utilities xxx was not expected at this time"
I just checked and found that path does not exist at all in my storage, so I removed it from PATH system env settings, and surprised things went normal after that!
To add to the answer of #John Wesley, I too had to alter my system's PATH enviroment variable to fix the "failed to retrieve msvc environment" error. However, my problem was slightly different.
In short, remove any unused directories from your PATH.
To explain, my PATH contained the following entries in the following order:
C:\Program Files (x86)\Common Files\Oracle\Java\javapath;
C:\ProgramData\Oracle\Java\javapath;
C:\Program Files (x86)\Intel\iCLS Client\;
C:\Program Files\Intel\iCLS Client\;
C:\Windows\system32;
C:\Windows;
C:\Windows\System32\Wbem;
[lots more enties followed...]
Hence my case was different to John's because it already had the required entries of:
C:\Windows\system32;
C:\Windows;
C:\Windows\System32\Wbem;
The fix for my system was to delete the first two entries (which I do not need because I manually set my Java paths). After I did that, I reopened Qt Creator and it worked!
It has been working for the past week without problem, however, sometimes the message "failed to retrieve msvc environment" still pops up for a moment, but then disappears again.
I met this error building qt project in Qt Creator. then solved by adding some paths to my system path, which not included them before.
C:\Windows\System32
C:\Windows
C:\Windows\System32\Wbem
Then reopen Qt Creator.
I faced the same problem as you. I use Visual Studio 2017 Community Edition with Qt 5.6.0. Windows 10.
In the beginning, I used "Visual Studio Installer" to repair. However it does not work.
Then I append "C:\Windows\System32" to "PATH" variable to Environment variables" since chcp is a exe in System3 and somehow I cannot find "C:\Windows\System32" in "PATH".
After that, I delete the Visual Studio (C:\Program Files (x86)\Microsoft Visual Studio) directly from File Explorer. ( I shift+deleted it )
Then re-install the "Visual Studio 2017" again.
It works!
I do not know which step is important. I think to add System32 to PATH variable and re-install VS2017 may the solution
In my case, I found the problem in my System Path variable. If the Path contains double quote anywhere, Qt emits this error.
I have meet the "error: Failed to retrieve MSVC Environment" for no reason. I deleated the debug file of my project and it does work.
Related
I'm getting a common error on the issue that I'm having but nothing has worked:
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\yvals.h(12,10): fatal error C1083: Cannot open include file: 'crtdbg.h': No such file or directory
I've been told to download the C++ dev kit again, the Windows SDK again, Reset my PC after download and manually change the path inside the file that can't find it.
As it turns out the file exists (and the Windows SDK too, I assume), Visual studio is just looking for it in the wrong spot, So I figure this is a setup issue. It exists in this location C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt. You could say why not just manually link to it? I have but then another file can't be found, so I change that and then another one can't be found and so on. I'd appreciate the help as this is the reason I get scared to use Visual Studio and go back running to Code, thank you!
Does this issue also occur if I create an empty C++ project and build it? If it works fine, this issue is more relevant to your current project.
Please check the target platform version of your project. Right click the project name and select ‘Properties’—‘Configuration Properties’—‘General’— ‘Windows SDK Version’ like the following, and select the Windows 10 SDK to have a try.
You could also refer to the method in this issue.
(PS:You need to make sure that the SDK you install is consistent with the operating system, for example if you use Win 11 then you should install the Windows 11 SDK.)
I got this error while trying to build my project on a buildAgent running as a service, does anyone have a solution for it?
TRACKER : error TRK0002: Failed to execute command: ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\CL.exe" #C:\BuildAgent\temp\buildTmp\tmpfde187c5fd8a42299ab4d18e25e0c9fe.rsp". The operation identifier is not valid.
i tried a solution to a similar issue when building the project in command line (using "_IsNativeEnvironment" variable ) but it didn't work for me, also i need the solution to work on my local computer permanently.
This error will happen with multiple tools when launching MSBuild from the command line:
CL.exe
cvtres.exe
Lib.exe
link.exe
adding them to the exclusion list of the active antivirus can fix some of the issues, but will not be enough with a modern antivirus.
An alternative is to deactivate Tracker.exe which is a tool that enable incremental builds. As it's not something you generally want on a build server, I found it safe to deactivate.
You can deactivate it by passing this parameter to msbuild: /p:TrackFileAccess=false
Windows Logs\Application in Windows Event Viewer may have clues about that.
In my case, it produce an event like
Activation context generation failed for "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\CL.exe".Error in manifest or policy file "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\CL.exe.Config" on line 0. Invalid Xml syntax.
I simply remove that .config file and it works.
This happens me when the aggressive virus scanner in my org secretly detects these files as malicious and removes them in the background.
In my case, changing the rules of the virus scanner resolves this problem.
This happened to me because I was sending the wrong "/p:VisualStudioVersion" to msbuild.
I upgrated to a newer version of vs but I didn't update the command line script that was building my project.
Changing the "/p:VisualStudioVersion" to the major version of vs that was actually installed on my machine fixed the problem.
I had this troublesome error.
I deleted my local TEMP folder completely and rebooted.
C:\Users\ [USER]\AppData\Local\Temp
I am trying to check if the visual studio compiler exist in my path. I have add vc/bin dir to the system environment path. When I open a windows console terminal I try to call cl.exe from the console. I am receiving the following message:
The program cant start because mspdb140.dll is missing from your computer. Try reinstalling the program to fix this problem.
What exactly is this message stands about? I tried to followed the instructions from this post, I run the bat file, (furthremore I add manually the dll dir in the path). However I am receiving the same message.
I have add vc/bin dir to the system environment path
That certainly isn't enough. Unclear what else you are doing. There are a wholeheckofalot more environment variables that need to be hacked correctly to allow proper compiling and linking. The values of INCLUDE and LIB are critical for example.
There is a .bat file that takes care of it, vc/vcvarsall.bat in the VS install directory. You pass the architecture you want to target, default is x86. Be sure you use the CALL statement if you use a .bat file yourself and that you in fact see the variables being set correctly with, say, SET INCLUDE. Watch out for a broken PATH variable, a very common scourge on programmers' machines. Usually corrupted by a wonky installer.
The VS installer creates shortcuts to run this .bat file. Used to be named "Visual Studio Command Prompt", might be "Developer Command Prompt". Got pretty muddy since Windows 8.
I personally just an entry in the VS Tools menu. Very handy. Use Tools > External Tools > Add button. And fill out the dialog similar to this:
Title = Command Prompt
Command = cmd.exe
Arguments = /k ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"" x86
Initial directory = $(ProjectDir)
Tweak 14.0 to the version number of your VS version, that's VS2015. VS2013 = 12.0, VS2012 = 11.0, VS2010 = 10.0
I tried to compile the source code of cryengine 3 and I always get the following error message.
Error 1 error : Required file "tracker.exe" is missing. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets 251 6 CryGame
For some reason I couldn't find any information on google.
Could it be possible that my Visual Studio installtion is somehow corrupt? I am still using the release candidate
A quote from MS website about tracker.exe:
Tracker.exe is required to correctly incrementally generate resources
in some circumstances, such as when building on a 64-bit OS using
32-bit MSBuild. This build requires Tracker.exe, but it could not be
found. The task is looking for Tracker.exe beneath the
InstallationFolder value of the registry key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A.
Possible solutions:
Install the Microsoft Windows SDK v7.0A or later.
Manually set the above registry key to the correct location.
You short-circuit that lookup instead by setting the
ResGenTrackerSdkPath property to the 7.1 .NET 4.0 tools location. In
the build definition, under "MSbuild Arguments", you can add the
following:
/p:ResGenTrackerSdkPath=":\Program Files(x86)\Microsoft SDKs\Windows\v7.1\Bin\NETFX 4.0 Tools
EDIT: your path may differ a little, but this still shows the general path to add
You can go to the directory "C:\Program Files (x86)\Microsoft SDKs\Windows".
Then, you search for the key "tracker.exe", if you can't find it, it might been deleted somehow.
The best way is:
Copy the folder "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools"
To your PC at the same directory.
If it didn't work, you can copy the folder into them[the following picture] every one.
picture:
As soon as I open the VS cmd prompt it says "ERROR: Cannot determine the location of the VS Common Tools folder." I'm trying to compile and eventually run my program using a compile.bat and run.bat file.
My program successfully compiled ONCE when I had the following in my compile.bat file:
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
FileMgr.sln /rebuild debug
pause
After it worked, I tried adding the path of vcvarsall.bat in the variable "Path" in Environment Variables, hoping I wouldn't need that initial call line in the .bat file. This didn't work so I deleted the newly added path from "Path" but now I'm getting this error.
This can only go wrong if the registry is messed up on your machine or the VS install didn't go well. The .bat file reads the setting from the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VS7\10.0 value. Insert Wow6432Node for a 64-bit operating system. Double-check with regedit.exe, the SysInternals' ProcMon utility is always handy to troubleshoot registry problems.
Get your machine stable again, ask questions about that at superuser.com. Try a VS2010 repair to fix the registry first, reinstall next. Shove it out of a 4th story window if all fails.