Can I use std::chrono on 2009 x86 Windows? - 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.

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.

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.

VS 2017 compiled exe not running on Windows 7

I've installed VS 2017 on Windows 7 machine and built the C++ project targeting 8.1 SDK, but the binaries are not starting on windows 7. The same works on Windows server 2016 and Windows 10 OS.
I had checked VC 2015 runtime is installed on both the windows server and windows 7 machine. And windows 8.1 SDK (as part of VS 2015?) is installed on my local machine running on Windows 7. Previously, I had Visual studio 2015 installed and the binaries used to work fine both on windows 7 and windows server.
I am not sure if the runtime dlls in windows\system32 are corrupted or changed due to VS 2017 installation.
PS: I noticed the same issue of exe not starting when running the newly installed firefox which comes with C-runtime dlls packed.
The problem turned out to be due to the use of the instruction set (AVX2) used by the dependency project, that wasn't available in the windows machine.

How to target Windows XP sp3 when compiling with Visual C++ 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

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