How to target Windows XP sp3 when compiling with Visual C++ 2010? - visual-studio-2010

I am trying to compile a C++ program using Visual Studio 2010 Pro on a Windows 7 computer to target Windows XP sp3 32 bits.
I've played around with the compiler and linker settings, but I'm unable to produce an executable that can run on my Windows XP computer. I always get the error "Could not find entry point for function GetTickCount64 in kernel32.dll" and the program doesn't run. I know Windows XP does not support GetTickCount64() and I'm not using it in my code anyways.
I don't have other versions of Visual Studio installed, and I already installed Visual C++ 2010 Redistributable Package on the windows XP machine.
Any idea on how to accomplish this?
Thanks before hand.

VC2010 targets Windows 7 by default.
To change target to XP, check Using the Windows Headers

Related

Can I use std::chrono on 2009 x86 Windows?

Is std::chrono available to use when running on a Windows 6.1.7601 x86 PC? (Windows 7 Professional, SP1).
I'm compiling in Visual Studio 2022 (on a new x64 PC) and don't care about other targets.
I just don't know if I'm doing it wrong, or if I'm just totally off base; when running, it goes straight to the "program.exe has stopped working" popup. The latest visual C++ x86 redistributable is installed on both the target and compilation computers.
My program is command-line only, and needs to access file last modified times and the current system time.

Visual Studio 2008 DEBUG build of 32-bit appli CRASHES on a 64-bit Win 10 PC but same appli works when we install Visual Studio 2008 on 64-bit Win10

I'm facing the following issue:
Background
I have a Win32 legacy application (exe & dll's) and drivers (dll's) written on Visual Studio 6.0 that used to run
well in Debug version on Windows Xp (Please Note: We need it in DEBUG configuration & not Release).
I copy the Visual studio 6.0's msvc* type dll's, MFC dll's & manifest files along with the exe to make it run.
Issue:
The same legacy 32-bit application & driver dll's have now been newly compiled in Visual Studio 2008 DEBUG mode.
It is then copied to a PC running on 64-bit Windows 10 PC (also tried Windows 7 without success) without having VS2008
installed. I copy the VS2008's msvc* type dll's (msvcp90d.dll, msvcr90d.dll), MFC dll's and manifest file (Microsoft.VC90.DebugCRT.manifest) also along with the exe.
On launching this debug version of the application (it does many initialization activities on startup and also calls the init methods of driver dll's) it crashes on starting up both on a 64-bit Windows 10 & Windows 7 PC.
What works:
When VS2008 is installed on the Windows 10 PC, the application's debug version launches correctly without crash and works fine.
(Also please note that same application's Debug build using the old Visual Studio 6.0 works fine on Windows 10).
What DOESN'T work:
When VS2008 is NOT installed on a Windows 10 PC, the application's debug version crashes while it is being launched.
Requirement
We absolutely need the DEBUG configuration of the application to run on the Windows 10 PC.
Development environment
OS for development: 64-bit Windows 7
Target OS: 64-bit Windows 10
IDE: Visual Studio 2008 SP1
Application & driver dlls/exe's: 32-bit
I have tried many workarounds like building by using 32-bit paths in VS2008 ($\Program Files (x86)\Microsoft SDKs\Windows..),
installed redistributables of VS2008 (both x86 & x64),
running as 'Administrator' user,
running in compatibility mode (Win Xp..),
copying dll's from system32 folder of a PC having VS2008 installed to a PC without VS2008 etc.. but the Debug build always crashes on it's startup.
Any help or pointers would be appreciated.
Please let me know if you would like to have further details.
Thank you in advance.

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.

"FltUser.h - no such file or directory" when compiling with v140_xp toolset on visual studio 2015

I wrote a minifilter driver and I want it to run on windows xp.
Therefore I compiled it with platform toolset v140_xp and I noticed the file FltUser.h doesnt exists on Windows SDK version 7.1.
Someone know how I can use FltUser.h and still use SDK 7.1 (so it will support Windows XP SP2)
Thanks.

Side-by-side assemblies, Windows 7, and Visual Studio 2005

I have a Windows 7 machine with Visual Studio 2005 SP1 installed. Using this, I build an application which loads a DLL at runtime compiled with VS2005 SP1 but on Windows XP. This fails, with the following error:
"...\foo.dll": The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.
The DLL loaded is compiled against the debug CRT. The answer to this question hints that vcredist_x86.exe only contains release-versions of the CRT. I'm not sure if that is relevant in this case, since both my machine and the machine on which the DLL was compiled on both have the full VS2005 SP1 installed.
Should I attempt to rebuild the DLL on Windows 7 (I'd prefer not to), and will that cause the DLL to become unusable on the Windows XP machine?
Problem solved. The problem was that the Windows 7 machine did not have the KB971090 update which was installed on the Windows XP machine which built the DLLs. I had to explicitly tell Windows Update that I wanted to receive non-Windows updates in order to be able to install the update.

Resources