Having installed VS 2019 on my PC, and opening up a new project, i get 408 errors that all say it cannot open various source .h files, such as errno.h, float.h, corecrt.h, etc. or 'the global scope has no "acosf" 'I had just installed visual studio and have no clue how it works, and have not done anything other than install it and open up a new project.
Possibly useful information:
It was not installed in the default location, but on the D: drive
visual studio works fine when I open it with unity to edit scripts for my unity projects, but when opening it from its desktop icon or from the start menu, i get the errors
Unity was installed before i installed Visual studio and appears to be using a different version of visual studio somewhere else on my PC, but i cant find where it is, hence me installing it myself
The project is a C++ project
I have already tried repairing visual studio and reinstalling it, but it did not work.
I had the same issue (here), the problem is that for some reason, MSVS is not adding the Windows Universal CRT SDK to the include and library paths (this SDK has the header files for things like "float.h" and so on).
To add it to your project, you need to add the include and lib paths in the Project settings.
In my case they were:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt <- header path
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x64 <- library path
(you can find it by searching for "float.h", and "ucrtd.lib", but be careful not to use the path for Linux headers).
You can add these paths at: Project Properties -> C/C++ -> General -> Additional Include Directories (add header path here)
and then Project Properties -> Linker -> General -> Additional Library directories (add library path here).
I suggest you could to check the version of Windows SDK in visual studio installer. And then set the appropriate version of windows sdk in the property -> General -> windows SDK version.
I have a VS 2015 C++ project (64-bit Windows 10 + Windows 10 SDK).
With the Project Properties > General > Target Platform Version set to "8.1", everything builds fine.
When I change it to "10.0.15063.0", I hit this error:
Error TRK0005 Failed to locate: "rc.exe". The system cannot find the file specified.
I saw from other posts that the fix is to paste the exe to somewhere it can be found. I'm looking for something a bit more solid (e.g. version controlled).
When set to 8.1, the $(WindowsSDK_ExecutablePath) macro includes this path:
C:\Program Files (x86)\Windows Kits\8.1\bin\x86
with rc.exe in it.
When set to 10.0.15063.0, none of the paths in the macro have an rc.exe inside them. If I add this path to the Executable Directories, the problem goes away:
C:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x64
My questions:
Is what I'm seeing expected or should rc.exe be found out-the-box?
Is it safe for me to add this extra path or am I likely to break something?
Am I using the correct extra path? (The 8.1 path includes "x86".)
Thanks
1) rc.exe should be found out of the box.
The issue may be related to a different Windows 10 SDK path schemes which was changed in newer Windows 10 SDKs.
Please, check, if VS2015 files point to the folder
C:\Program Files (x86)\Windows Kits\10\bin\x64
(You can see the value of the macro for $(WindowsSDK_ExecutablePath)).
Latest Windows 10 SDK are installed in parallel subfolders so you may install different Windows 10 SDK, with folders like:
C:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x64
C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x64
If VS expects SDK in general folder - Windows Kits\10\bin\, you may copy rc.exe, rc.dll there from bin\10.0.15063.0\ (from \x86 to \x86, from \x64 to \x64).
This is inconsistency in VS2015 / Win 10 SDK install.
2) If you put actual rc.exe path into the Project Properties > Configuration Properties > Executable Directories, at the end, it is generally safe. Paths are iterated from left to right, and the last one will be searched only if .exe was not found in the previous predefined ones.
3) VS may build .rc resource files always with 32-bit rc.exe from \x86 folder, depending on the variable in Executable Paths. It may be set to $(WindowsSDK_ExecutablePath).
This actually should not matter, as these are 32-bit / 64-bit versions of the compiler executables with equivalent functionality.
You can track which compiler .exe files MSBuild invokes in Output window, if increase verbosity:
Tools > Options > Projects and Solutions > Build and Run > MSBuild project build output verbosity > Detailed.
Not the cleanest solution but here's how I solved it, as #Alexey said, I also have 2 SDKs, 10 and 8.1 and probably that's where the error came from.
I just added the path:
C:\Program Files(x86)\Windows Kits\8.1\bin\x64
to the PATH in Windows environment variables
Note: The x64 at the end of the path, needs to be changed if you are compiling for a different architecture.
In addition, the path is where the rc.exe is located on my PC, you should make sure that it is indeed in the same place on your PC as well.
Do not forget to close and reopen Visual Studio after the change to update the environment variables.
I installed one of the latest Windows SDK version, 10.0.19041.0,and found that the rc.exe is there the architecture folder under the SDK version in the bin folder. Here is what I mean:
C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64
I found a number of default Macros already created so I use them to make the path more generic in case if I have to change the platform target to a differernt version.
This is the path using the Macro and it's working for me.
$(WindowsSdkDir)bin\$(WindowsTargetPlatformVersion)\$(PlatformTarget)
So, the rc.exe is there. You just need to find where it is and add its path to the VC++ Directories\Executable Directories in the configuration dialog.
Edit:
Some people started to mark my question as a duplicate. Do not forget that many similar questions existed when I asked this one (see e.g. the list below). However, none of these answers solved my problem. After a long search I found a comment which had been ignored by all users pointing to the missing lib. Now, many months later, the comment has been changed to an answer. However, when I answered this question by msyself I intended to help other people by directly providing the solution. This should not be forgotten and so far my answer helped a lot of people. Therefore my question is definitely not a duplicate. By the way: The accepted answer within the provided link on top does not solve the problem!
Yes, i used the search:
Failed to load platform plugin "windows". Available platforms are : Error
Deploying Qt C++ Application from Visual Studio qwindows.dll error
failed to load platform plugin "windows" Available platforms are: windows, minimal
However, in my case the problem still persists. I am using Qt 5.1.1 with Visual Studio 2012 and developed my Application on Windows 7 with Qt Creator 2.8.1. Application is compiled in "Release"-mode and can be executed if directly started with Qt Creator.
However, when starting from the "release"-Folder, i get the following message:
This application failed to start because it could not find or load the
Qt platform plugin "windows". Available platform plugins are:
minimal, offscreen, windows.
Folder structure looks like this:
release
+ gui.exe
+ icudt51.dll
+ icuin51.dll
+ icuuc51.dll
+ libGLESv2.dll
+ Qt5Core.dll
+ Qt5Gui.dll
+ Qt5Widgets.dll
+ platforms
Platforms is the folder directly copied from Qt\Qt5.1.1\5.1.1\msvc2012\plugins\platforms including e.g. qwindows.dll. Does not matter if I rename it to "platform" as some other users did. Qt is still not finding the "platform plugin windows", where is my mistake?
Okay, as posted here https://stackoverflow.com/a/17271172/1458552 without much attention by other users:
The libEGL.dll was missing! Even though this has not been reported when trying to start the application (all other *.dlls such as Qt5Gui.dll had been reported).
I created a platforms directory next to my exe location and put qwindows.dll inside, but I still received the "Failed to load platform plugin "windows". Available platforms are: windows" error.
I had copied qwindows.dll from C:\Qt\Qt5.1.1\Tools\QtCreator\bin\plugins\platforms, which is not the right location. I looked at the debug log from running in Qt Creator and found that my app was looking in C:\Qt\Qt5.1.1\5.1.1\mingw48_32\plugins\platforms when it ran in the debugger.
When I copied from C:\Qt\Qt5.1.1\5.1.1\mingw48_32\plugins\platforms, everything worked fine.
The release is likely missing a library/plugin or the library is in the wrong directory and or from the wrong directory.
Qt intended answer: Use windeployqt. see last paragraph for explanation
Manual answer:
Create a folder named "platforms" in the same directory as your application.exe file. Copy and paste the qwindows.dll, found in the /bin of whichever compiler you used to release your application, into the "platforms" folder. Like magic it works. If the .dll is not there check plugins/platforms/ ( with plugins/ being in the same directory as bin/ ) <-- PfunnyGuy's comment.
It seems like a common issue is that the .dll was taken from the wrong compiler bin. Be sure to copy your the qwindows.dll from the same compiler as the one used to release your app.
Qt comes with platform console applications that will add all dependencies (including ones like qwindows.dll and libEGL.dll) into the folder of your deployed executable. This is the intended way to deploy your application, so you do not miss any libraries (which is the main issue with all of these answers). The application for windows is called windeployqt. There is likely a deployment console app for each OS.
Setting the QT_QPA_PLATFORM_PLUGIN_PATH environment variable to %QTDIR%\plugins\platforms\ worked for me.
It was also mentioned here and here.
I ran into this and none of the answers I could find fixed it for me. My colleauge has Qt (5.6.0) installed on his machine at:
C:\Qt\Qt5.6.0\5.6\msvc2015\plugins
I have Qt (5.6.2) installed in the same location.
I learned from this post: http://www.tripleboot.org/?p=536, that the Qt5Core.dll has a location to the plugins written to it when Qt is first installed.
Since my colleague's and my Qt directories were the same, but different version of Qt were installed, a different qwindows.dll file is needed. When I ran an exe deployed by him, it would use my C:\Qt\Qt5.6.0\5.6\msvc2015\plugins\platforms\qwindows.dll file instead of the one located next to the executable in the .\platforms subfolder.
To get around this, I added the following line of code to the application which seems to force it to look next to the exe for the 'platforms' subfolder before it looks at the path in the Qt5Core.dll.
QCoreApplication::addLibraryPath(".");
I added the above line to the main method before the QApplication call like this:
int main( int argc, char *argv[] )
{
QCoreApplication::addLibraryPath(".");
QApplication app( argc, argv );
...
return app.exec();
}
create dir platforms and copy qwindows.dll to it, platforms and app.exe are in the same dir
cd app_dir
mkdir platforms
xcopy qwindows.dll platforms\qwindows.dll
Folder structure
+ app.exe
+ platforms\qwindows.dll
I found another solution. Create qt.conf in the app folder as such:
[Paths]
Prefix = .
And then copy the plugins folder into the app folder and it works for me.
For anyone coming from QT version 5.14.0, it took me 2 days to find this piece statment of bug:
windeployqt does not work for MinGW QTBUG-80763 Will be fixed in
5.14.1
https://wiki.qt.io/Qt_5.14.0_Known_Issues
So be aware. Using windeployqt withMinGW will give the same error stated here.
I had this problem while using QT 5.6, Anaconda 4.3.23, python 3.5.2 and pyinstaller 3.3.
I had created a python program with an interface developed using QTcreator, but had to deploy it to other computers, therefore I needed to make an executable, using pyinstaller.
I've found that the problem was solved on my computer if I set the following environment variables:
QT_QPA_PLATFORM_PLUGIN_PATH: %QTDIR%\plugins\platforms\
QTDIR: C:\Miniconda3\pkgs\qt-5.6.2-vc14_3\Library
But this solution only worked on my PC that had conda and qt installed in those folders.
To solve this and make the executable work on any computer, I've had to edit the ".spec" (file first generated by pyinstaller) to include the following line:
datas=[(
'C:\Miniconda3\pkgs\qt-5.6.2-vc14_3\Library\plugins\platforms*.dll',
'platforms' ),]
This solution is based on the answers of Jim G. and CrippledTable
For me the solution was to correct the PATH variable. It had Anaconda3\Library\bin as one of the first paths. This directory contains some Qt libraries, but not all. Apparently, that is a problem. Moving C:\Programs\Qt\5.12.3\msvc2017_64\bin to the front of PATH solved the problem for me.
Most of these answers contain good (correct) info, but in my case, there was still something missing.
My app is built as a library (dll) and called by a non-Qt application. I used windeployqt.exe to set up the Qt dlls, platforms, plugins, etc. in the install directory, but it still couldn't find the platform. After some experimentation, I realized the application's working directory was set to a different folder. So, I grabbed the directory in which the dll "lived" using GetModuleHandleExA and added that directory to the Qt library path at runtime using
QCoreApplication::addLibraryPath(<result of GetModuleHandleExA>);
This worked for me.
I had the same problem and solved it by applying several things.
The first, if it is a program that you did with Qt.
In the folder (in my case) of "C: \ Qt \ Qt5.10.0 \ 5.10.0 \ msvc2017_64 \ plugins" you find other folders, one of them is "platforms". That "platforms" folder is going to be copied next to your .exe executable. Now, if you get the error 0xc000007d is that you did not copy the version that was, since it can be 32bits or 64.
If you continue with the errors is that you lack more libraries. With the "Dependency Walker" program you can detect some of the missing folders. Surely it will indicate to you that you need an NVIDIA .dll, and it tells you the location.
Another way, instead of using "Dependency Walker" is to copy all the .dll from your "C: \ Windows \ System32" folder next to your executable file. Execute your .exe and if everything loads well, so you do not have space occupied in dll libraries that you do not need or use, use the .exe program with all your options and without closing the .exe you do is erase all the .dll that you just copied next to the .exe, so if those .dll are being used by your program, the system will not let you erase, only removing those that are not necessary.
I hope this solution serves you.
Remember that if your operating system is 64 bits, the libraries will be in the System32 folder, and if your operating system is 32 bits, they will also be in the System32 folder. This happens so that there are no compatibility problems with programs that are 32 bits in a 64-bit computer.
The SysWOW64 folder contains the 32-bit files as a backup.
For a MinGW platform and if you are compiling a Debug target by a hand made CMakeLists.txt written ad hoc you need to add the qwindows.dll to the platform dir as well.
The windeployqt executable does its work well but it seems that for some strange reason the CMake build needs the release variant as well.
In summary it will be better to have both the qwindows.dll and qwindowsd.dll in your platform directory.
I did not notice the same strange result when importing the CMake project in QtCreator and then running the build procedure.
Compiling on the command line the CMake project seems to trigger the qwindows.dll dependency either if the correct one for the Debug target is set in place (qwindowsd.dll)
Use this batch file: RunWithQt.bat
#echo off
set QTDIR=C:\Qt\Qt5.1.1\5.1.1\msvc2012\bin
set QT_QPA_PLATFORM_PLUGIN_PATH=%QTDIR%\plugins\platforms\
start %1
to use it, drag your gui.exe file and drop it on the RunWithQt.bat in explorer,
or call RunWithQt gui.exe from the command line
If you have Anaconda installed I recomend you to uninstall it and try installing python package from source, i fixed this problem in this way
The application qtbase/bin/windeployqt.exe deploys automatically your application. If you start a prompt with envirenmentvariables set correctly, it deploys to the current directory.
You find an example of script:
#echo off
set QTDIR=E:\QT\5110\vc2017
set INCLUDE=S:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\ATLMFC\include;S:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\include;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\ucrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\shared;C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\winrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\cppwinrt
set LIB=S:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\ATLMFC\lib\x86;S:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\lib\x86;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x86;C:\Program Files (x86)\Windows Kits\10\lib\10.0.14393.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\lib\10.0.14393.0\um\x86;
set LIBPATH=S:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\ATLMFC\lib\x86;S:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\lib\x86;S:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\lib\x86\store\references;C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.17134.0;C:\ProgramFiles (x86)\Windows Kits\10\References\10.0.17134.0;C:\Windows\Microsoft.NET\Framework\v4.0.30319;
Path=%QTDIR%\qtbase\bin;%PATH%
set VCIDEInstallDir=S:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\
set VCINSTALLDIR=S:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\
set VCToolsInstallDir=S:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\
set VisualStudioVersion=15.0
set VS100COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\
set VS110COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\
set VS120COMNTOOLS=S:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\
set VS150COMNTOOLS=S:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\
set VS80COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\Tools\
set VS90COMNTOOLS=c:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools\
set VSINSTALLDIR=S:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\
set VSSDK110Install=C:\Program Files (x86)\Microsoft Visual Studio 11.0\VSSDK\
set VSSDK150INSTALL=S:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VSSDK
set WindowsLibPath=C:\Program Files (x86)\Windows Kits\10\UnionMetadata;C:\Program Files (x86)\Windows Kits\10\References
set WindowsSdkBinPath=C:\Program Files (x86)\Windows Kits\10\bin\
set WindowsSdkDir=C:\Program Files (x86)\Windows Kits\10\
set WindowsSDKLibVersion=10.0.14393.0\
set WindowsSdkVerBinPath=C:\Program Files (x86)\Windows Kits\10\bin\10.0.14393.0\
set WindowsSDKVersion=10.0.14393.0\
set WindowsSDK_ExecutablePath_x64=C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\x64\
set WindowsSDK_ExecutablePath_x86=C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\
mkdir C:\VCProjects\Application\Build\VS2017_QT5_11_32-Release\setup
cd C:\VCProjects\Application\Build\VS2017_QT5_11_32-Release\setup
copy /Y ..\Release\application.exe .
windeployqt application.exe
pause
Lets say, you wanted to have some CGAL-Demos portable. So you'd have a folder "CGAL", and in it, 1 subfolder called "lib": all (common) support-dlls for any programs in the CGAL-folder go here. In our example, this would be the Dll-Download: simply unzip into the "lib" directory. The further you scroll down on the demos-page, the more impressive the content. In my case, the polyhedron-demo seemed about right. If this runs on my 10+ yo notebook, I'm impressed. So I created a folder "demo" in the "CGAL"-directory, alongside "lib".
Now create a .cmd-file in that folder. I named mine "Polyhedron.cmd". So we have a directory structure like this:
CGAL - the bag for all the goodies
lib - all libraries for all CGAL-packages
demo - all the demos I'm interested in
[...] - certainly some other collections, several apps per folder...
Polyhedron.cmd - and a little script for every Qt-exe to make it truly portable.
In this little example, "Polyhedron.cmd" contains the following text:
#echo off
set "me=%~dp0"
set PATH=%me%lib
set "QT_PLUGIN_PATH=%me%lib\plugins"
start /b "CGAL Polyhedron Demo" "%me%demo\polyhedron\polyhedron_3.exe"
All scripts can be the same apart from the last line, obviously. The only caveat is: the "DOS-Window" stays open for as long as you use the actual program. Close the shell-window, and you kill the *.exe as well. Whereever you copy the "CGAL"-folder, as the weird "%~dp0"-wriggle represents the full path to the *.cmd-file that we started, with trailing "\". So "%me%lib" is always the full path to the actual library ("CGAL\lib" in my case). The next 2 lines tell Qt where its "runtime" files are. This will be at least the file "qwindows.dll" for Windows-Qt programs plus any number of *.dlls. If I remember rightly, the Dll-library (at least when I downloaded it) had a little "bug" since it contains the "platforms"-directory with qwindows.dll in it. So when you open the lib directory, you need to create a folder "plugins" next to "platforms", and then move into "plugins". If a Qt-app, any Qt-app, doesn't find "qwindows.dll", it cannot find "windows". And it expects it in a directory named "platforms" in the "plugins" directory, which it has to get told by the OS its running on...and if the "QT_PLUGIN_PATH" is not exactly pointing to all the helper-dlls you need, some Qt-programs will still run with no probs. And some complain about missing *.dlls you've never heard off...
I ran into the same error and solved it with a different method than those mentioned in other posts. Hopefully this will help future readers.
BUILD:
Windows 10 (64bit)
Minicoda (using python 3.9.4) (pkgs are from conda-forge channel)
pyqt 5.12.3
My scenario:
I was building a GUI application for some embedded work. I had two machines that were used for development (same OS and architecture), one had zero internet connection. After packaging up my environment and installing on the offline machine, I ran into the error that you got.
Solution:
locate the qt.conf file in your conda environment.
for me: C:\Users\"name"\miniconda3\envs\"env_name"\qt.conf
Make sure the paths are correct. I needed to update the "name" as this was left over from the old machine.
Hopefully this helps someone.
I had the same problem of running a QT5 application in windows 10 ( VS2019).
My error was
..\Debug\Qt5Cored.dll
Module: 5.14.1
File: kernel\qguiapplication.cpp
Line: 1249
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Solution
Since I was using QT msvc2017, I copied plugins folders from "C:\Qt\Qt5.14.1\5.14.1\msvc2017\plugins" location to the binary location
it worked.
Then check visual studio output window and identify the dlls loaded from plugin folder and removed unwanted dlls
Setting QT_PLUGIN_PATH env variable to <...>/plugins directory also worked for me.
I got the error when Pycharm was trying to run Matplot. The solution that worked for me was setting the Anaconda3\Library\plugins directory (for example: c:\Program files\Anaconda3\Library\plugins) as environment variable "QT_PLUGIN_PATH".
To set that you should go to Control Panel / System / Advanced System Settings / Environment Variables.
Talking mainly about the Windows platform
Faced the same issue when trying to debug the app build using the vcpkg installed Qt library, while having my app build using cmake. Had trouble for some hours until found the solution. The simplest way is to do the following:
in your build folder, find the folder where the final executable is located.
in that folder, you'll find some Qt libraries, like Qt6Core.dll.
pay attention to whether or not the library file has the d suffix in its name, i.e. Qt6Cored.dll instead of Qt6Core.dll
in the vcpkg folder, you have 2 options
./installed/x64-windows/Qt6/plugins/platforms
./installed/x64-windows/debug/Qt6/plugins/platforms
if the d suffix was present, copy the content of the ../debug/.. folder (otherwise the other one) into the platforms folder in the same folder, where your executable and the Qt libraries are located (if there's no such folder, create on your own).
You can somehow automate this process. Leaving that task to you. If I do that on my own, will update the answer.
Edit
If you are using CMakeLists you may want to give this a try. Add the following to your app's CMakeLists.txt
# assuming your target's name is app
if(WIN32)
add_custom_command(
TARGET app POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${Qt6_DIR}/../../$<$<CONFIG:Debug>:debug/>Qt6/plugins/platforms/
$<TARGET_FILE_DIR:app>/platforms/
)
endif()