Use OpenMP with Windows SDK - winapi

I am aware that VC2010 Express Edition does not include OpenMP support and therefore would report omp.h file missing. Therefore, I have installed Windows SDK v7.1 64-bit version in Windows. However, even I ran:
set DISTUTIL_USE_SDK=1
setenv /x64 /release
And then try to compile the code, it would still report cannot find omp.h. Could anyone give me a hint on how to solve this?

Did some checking, and it appears that OpenMP is not part of the Windows SDK, and is only shipped with Visual C++ 2010 Professional or Ultimate editions.

Related

Targeting older Windows versions (Windows Server 2008 R2)

I have an older Windows 10 workstation with Rust 1.37 (stable-x86_64-pc-windows-msvc) and Visual Studio 2017 with the following features:
Visual C++ Build Tools core features
VC++ 2017 version 15.9 v14.16 latest v141 tools
Visual C++ 2017 Redistributable Update
Windows 10 SDK (10.0.17763.0)
Visual C++ tools for CMake
Testing tools core features - Build Tools
On this workstation, I can compile a program that runs fine on my target environment (Windows Server 2008 R2).
I have a newer Windows 10 workstation on which I installed the legacy version of Visual Studio 2017. Interestingly, the installer doesn't offer the exact same options for C++ build tools, but I think I have the necessary ones, e.g.:
VC++ 2017 version 15.9 v14.16 latest v141 tools
Visual C++ tools for CMake and Linux
Windows 10 SDK (10.0.17763.0)
However, when I compile the program (with the same Rust version/toolchain) on this computer, it errors out on my target environment with "The program can't start because VCRUNTIME140.dll is missing from your computer".
What am I missing here? How can I setup rustup/cargo to target my specific environment?
I think It’s because of not choosing some components when you install the vs.
by the way, vs 2015 is not a good choice.
So it turns out I was wrong: my project was not compiled with stable-x86_64-pc-windows-msvc on my older computer. I had at some point installed the x86_64-pc-windows-gnu toolchain and set it as the override for this project. Changing my toolchain to x86_64-pc-windows-gnu on the new computer produced a binary that was able to run on the target machine.
Rather than deleting this question, I'll leave it here for others who may need to target older Windows environments:
If you are having problems running a Rust binary on an older Windows computer, try compiling with x86_64-pc-windows-gnu rather than msvc.

Building OpenCV 3.4.1 on Windows 10 targeting Windows XP

I have an application that uses the OpenCV libraries. This application has to be installed on an old PC running Windows XP 32 bit. When running the application I got the error:
Kernel32.dll unable to import InitializeCriticalSectionEx
According to my searches, to fix this issue, I have to tell the compiler that the library will be used on Windows XP by setting the variable _WIN32_WINNT to 0x0501. I'm trying to apply the solution found in this entry in github, but I'm not very experienced with compilers and I'm having hard time to locate the files CMAKE_CXX_FLAGS and CMAKE_C_FLAGS. Can anyone explain me exactly what file I have to modify?
I'm using Visual Studio 2017 and Cmake on Windows 10.
I tried to use the toolset v140_xp in Visual Studio, but without success. At the end of the day, I got an old PC with Windows XP, installed Visual Studio 10 and tried to compile. The problem was that the latest version (3.4.1) won't compile for Windows XP. AFAIK, the most recent version of OpenCV that compiles for XP is 3.2. Probably it is possible to cross-compile it on Windows 10 using the v140_xp toolset, but I did not try as I already got the old XP with Visual Studio 10.

Any way to install ifort without installing visual studio previously in Windows?

I was drawn crazy this several days to make ifort work in my windows Os. Everytime I installed Ms visual studio firstly and then installed ifort as suggested, I could not find ifort when I was trying to build in the visual studio. What's more, if I ignore the visual studio and solely install ifort, the complier will complain during compiling compland throw me error message like
could not find 'link'
I do numerous searching for the solution but none works. Some suggest I can adjust the parallel studio setting, but I didn't find parallel in the ifort folder.
intel visual fortran demand windows development environment
Could not find link when solely install ifort
You're using a VERY old version. But this version does include a Visual Studio environment. If you have a commercial or academic license, go back to the Intel Registration Center and download the installer that says "Includes Microsoft Visual Studio Shell" (doesn't have _novsshell, _ia32 or _intel64 in the filename).
It would be better, of course, if you were to use a more current version.

Visual Studio 2010 Express, Windows SDK 7.1, CMake and 64 bit

I'm running into problems generating a Visual Studio 2010 Express 64 bit project through CMake. I installed VS2010 Express first, then the Windows SDK 7.1 in order to be able to build 64 bit apps and then tried to compile my CMake project.
I do not remember this to be that difficult with 2008 Express, but with 2010 I fail again and again. 2010 searches per default for 7.0a SDK which is shipped with it. The express version seems to ship a reduced 32 bit version, which is located under
.../Program Files(X86)/Microsoft SDKs/Windows/7.0a
Windows SDK 7.1 64bit will be installed per default under
.../Program Files/Microsoft SDKs/Windows/7.0
In VS 2010 Express the platform SDK can be changed on a per-project-map basis and if I do so the inherited path macros surprisingly point to the correct SDK. The problem now is, that CMake is not happy about me screwing around in the project files by myself. Thus, it always resets the Platform SDK entry to the default value, which will make the Windows SDK point to 7.0a and result in complaints about missing 64 bit libs.
I now see two possibilities to resolve this:
Find a way to really integrate the 7.1 SDK into VS2010 Express, just like with VS2008. VS2008 searches the registry for the tag 'CurrentInstallFolder' in the Windows SDKs entry, and you can change this entry to point to another SDK.
Find a way to tell CMake (2.8.1) to set the correct Platform SDK in the project. No plan how to do this...
I would appreciate any help. 2010 is somewhat mandatory unfortunately, I personally cannot get used to it at all...
Ok, updating to the latest CMake (2.8.12) resolved this, CMake now detects the 7.1 SDK and sets it in the project files.
Edit: The toolset can be chosen in a CMake file via the CMAKE_GENERATOR_TOOLSET flag

/analyze flag in Visual Studio 2010 Professional

Running Visual Studio 2008 Professional it is possible to enable static code analysis using the /analyze flag (even though this is not supported for the Professional version according to the documentation).
In Visual Studio 2010 Professional this no longer works. Instead there is a default /analyze- flag added (one I can't find a GUI setting for). This does not work as well as the VS2008 version (or at all).
Can anyone shed some light into this? What does the new /analyze- flag do and is there any way to enable the old analysis?
The compiler in 2010 is the non-enterprise one. VS 2008 happened to ship with the enterprise compiler. (Compare the output of cl /?)
/analyze- turns off static analysis. What you could do is see if the latest Platform SDK ships with the enterprise compilers (they did in the past), and configure your paths in VS to use them instead.
It can still be done by using the SDK and installing the latest compiler update, see:
http://randomascii.wordpress.com/2011/10/15/try-analyze-for-free/
Note that if you're using an x64 system, you'll need to manually set your environment to x86 mode (as x64 is the default) to get /analyze to work.
Upgrade to VS 2012 or VS 2013. They support /analyze in the professional SKU and it supports /analyze for both 32-bit and 64-bit. See my /analyze blog post for details:
http://randomascii.wordpress.com/2011/10/15/try-analyze-for-free/

Resources