dll library with cpprestsdk compilation on windows xp - windows

I have dll project using cpprestsdk in visual studio 2019 (along with console application for testing purposes).
On windows 7 and windows 10 original package works as expected, however I'm having hard time to compile and run on windows XP.
cpprestsdk is included in the project through NuGet, version: cpprestsdk.v141 but, its not visible for the compiler. Line #include <cpprest/http_client.h> throws an error.
Changes i've made:
platform toolset set to Visual Studio 2017 - Windows XP (v141_xp)
preprocessor definitions updated to include CPPREST_TARGET_XP
statically included cpprest141_2_10.dll
statically linked cpprest141_2_10.lib
console application setting ConformanceMode set to false
Now the app is compiling, but it's not working properly on windows 10 (crashes on sending request). and it's not starting on windows XP (dll entry point not found)
Any1 have any idea what's going on?
#edit:
after adding to program folder missing dlls:
api-ms-win-core-crt-l1-1-0.dll
api-ms-win-core-crt-l2-1-0.dll
httpapi.dll
it came to ntdll.dll
Entry Point Not Found error screenshot
The procedure entry point WinSqmAddToStreamEx could not be located in the dynamic link library ntdll.dll

all you need to do is downgrade your Visual studio to 2013 and donwload the version of cpprest SDK like 2.9.1 which support the VS 2013 (msvc 120) as well, hope it helps

Related

How to fix errors on standard headers in VisualStudio 2017 (on Windows 10) building a .dll - file for Windows XP

I'm working on a .dll - file that I will use for a program that is supposed to run on Windows XP. I am using VisualStudio 2017 on a Windows 10 machine for this and I want to build the project, consisting of all the necessary code for the .dll - file, thereby targetting Windows XP (64Bit).
Building the project for Windows 10 is no problem, I will show the settings I have selected for that below.
Trying to build with XP(64 Bit) as target, I get the following errors (a picture follows shortly):
Error C1083 Cannot open include file: 'processthreadsapi.h': No such file or directory
Error (active) E1696 cannot open source file "ip2string.h"
Error (active) E1696 cannot open source file "processthreadsapi.h"
Here are the configurations I have altered in both cases:
Windows 10 setup, build works fine
Windows XP setup, producing the error messages
error messages
I've already read
---> https://learn.microsoft.com/en-us/cpp/build/configuring-programs-for-windows-xp?view=vs-2017
and installed the apparently needed c++ runtime support, it still doesn't work. I am aware of choosing the Visual Studio 2015 toolsets.. I read multiple times about lacking support for the 2017 versions and people fixing their errors by choosing the 2015 option (choosing 2017 xp actually results in a few more errors in my case), which why I also tried it that way.
I would appreciate your help very much!
When you choose the XP toolset, Visual Studio uses a different include path with files from a older XP compatible version of the Windows SDK.
If you look at the functions defined in ip2string.h, the minimum version supported is Windows 7. I would imagine processthreadapi.h is an attempt at refactoring Windows.h and therefore isn't available in the XP SDK.
If you look at processthreadapi.h you will notice it is almost al guarded by
#pragma region Application Family or OneCore Family
Without seeing the code I am not sure exactly how to fix your problem, but I would suggest you try and use Windows.h everywhere instead of specific API includes.

Installation SDK 7.1

I want to ask about an error I faced durring the installation of SDK 7.1 compiler in order to compile .c files under matlab, knowing that I've downloaded SDK ISO and .exe but without use, from this link
http://www.microsoft.com/en-us/download/details.aspx?id=8279
I'm using Matlab 2013b,Windows7 64 bit
I got this error every time
Setup could not find the file WinSDK_amd64\WinSDK_amd64.msi at any of the specified source locations G:\Setup
I have an Intel i7, Win 7 64 bit and I was able to resolve this by downloading the Windows SDK 7.1 (iso image) from this link.
http://download.microsoft.com/download/F/1/0/F10113F5-B750-4969-A255-274341AC6BCE/GRMSDKX_EN_DVD.iso
I had tried several downloads and this was the only one that actually contained the ../setup/WinSDK_amd64\WinSDK_amd64.msi file that the error message references.
Previous to finding this download I had tried removing every single instance of the C++ redistributable for each version of Visual studio I had installed. This alone did not work, because the other Win 7 SDK downloads I tried did not contain the ../setup/WinSDK_amd64\WinSDK_amd64.msi file that the error message references.
You can find it using Visual Studio 2019 installer under the name "C++ Windows XP Support for VS 2017 (v141) tools [Deprecated]".

C++/CLI Missing MSVCR90.DLL

I have a c++/cli dll that I load at runtime and which works great in debug mode. If I try and load the dll in release mode it fails to load stating that one or more dependencies are missing. If I run depends against it I am missing MSVCR90.DLL from MSVCM90.DLL. If I check the debug version of the dll it also has the missing dependency, but against the debug (D) version.
I have made sure debug/release embed the manifest file. I read something about there being issues with the app loading the dll being build as Any CPU and the dll being built as x86, but I don't see how to set them both to x86.
I am using VS2010.
Anyway, I've been messing around for a while now and have no idea what is wrong. I'm sure someone out there knows what is going on. Let me know if I need to include additional info.
alt text http://www.freeimagehosting.net/uploads/fb31c0e256.png
UPDATE:
This ended up being the resolution to my problem: http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/07794679-159b-4363-ae94-a68fe258d827
MSVCR90 is the runtime for Visual Studio 2008. If you are running your application on your development PC, then you should have the debug and release runtimes installed (as part of Visual Studio) but it is possible something has gone awry with your install, or that VS2010 doesn't actually include the older runtimes. If you're trying to run the Release on a different PC, then it just needs the runtime installed.
Either way, you may be able to fix it by installing the Visual Studio 2008 redistributable - but make sure you get the right download for your PC (x86 or x64).
In previous versions of VS, you needed the runtime for the version you were compiling with, so if VS2010 follows this precedent you'd need MSVCR100, not MSVCR90 - which suggests that you may not have recompiled the dll with VS2010 - doing so may be another approach to get it running on your PC (using the redist that is in your VS2010 install) but beware that you will still need other users to install the appropriate (VS2010) redistributable on their PC.
As for "Any CPU" versus "x86", this is a problem only on a 64-bit computer. On those systems a 64-bit application can't link dynamically to 32-bit dlls. If you compile your application as "Any CPU" it will be JIT compiled to be 64-bit on an 64-bit OS, so will crash if it tries to call any 32-bit dlls directly. THe solution is to build the application targeting "x86" as that forces the JIT compiler to generate 32-bit code (even on a 64-bit machine) and thus ensures compatibility with the dll you wish to call. If the DLL is a managed assembly, then you can use Any CPU on both the app an dll as they will both be JITted to the same format.
It happened to me something similar running a website in Vistual Studio 2012, after migrating from Visual Studio 2010. The error message was saying that MSVCR90.DLL was missing. The solution was:
1) Delete the folder _bindeployable located at the project path.
2) Rebuild.
I hope it helps.

application failed to initialize properly (0xc0150002) [duplicate]

This question already has answers here:
The application failed to initialize properly (0xc0150002)
(5 answers)
Closed 5 years ago.
my mfc application created in visual studio 5 running on windows server 2000 sp4, i create a release for it and try running it win xp slp2. it gives me application failed to initialize properly (0xc0150002)
i have tried following things
-Install Microsoft Visual C++ 2005 SP1 Redistributable Package (x86) the one that comes within the release folder as well as one downloadable from website
copied all dll and mainfest from microsoft visual sutdio\vc\redist
I still keep receiving the same messsage. c
what could be wrong?how can i fix it
some things to check:
check the /SUBSYSTEM linker option for you project. It might include OS major/minor version numbers.
ensure that you are using appropriate Windows XP PlatformSDK on DEV machine; check values of WINVER, _WIN32_WINNT
use depends to see whether the problem is in unresolved dependencies
check the version of runtime that your application requires with that on target machine. I usually do this by looking at the app's manifest from one side and into WinSxS folder of the target machine from another (recently there had been an ATL Security update from Microsoft http://msdn.microsoft.com/en-us/visualc/ee309358.aspx; new binaries created by updated Visual Studio will not run on machines that haven't the same updated version of runtime).
It is possible you have applied a security update or compiler update to your VS2005 SP1. That makes it generate a manifest that requests a different MFC/CRT-dll than the one installed with Microsoft Visual C++ 2005 SP1 Redistributable Package (x86) .
Try to use Depends.exe and open your application, then in the menu choose "Profile". Look in the output window below for a more detailed description.
Are you trying to run the debug version? That may give you an error similar to 0xc0150002. Try the release build, or you could compile against the static libraries rather than dynamic libraries. If you get this problem on a release build then the chances are that it's a missing dll (in which case try running Depends.exe) or an incorrect manifest.
If you have a missing dependency on a runtime dll you could try creating a deployment project for it as this will detect the appropriate runtime dlls and build it into an installer for you.

undeclared identifier SO_EXCLUSIVEADDRUSE when building Apache Axis2/C

I'm attempting to build Apache Axis2/C (actually I'm building the WSO2 WSF/C++ wrapper for it) and it keeps giving me an error when it comes across the symbol SO_EXCLUSIVEADDRUSE. It's a socket option, and MSDN says it should be available. I'm using MSVC++ 6.0 on Win Server 2k3. I don't have a choice about the compiler or the OS... if I was on linux, I'd be done already :P
I looked at a VS2005 installation and discovered that it contains the #define for that constant in winsock2.h. It's not there in the winsock2.h that I have for MSVC6. Also, in VS2005, it's under the PlatformSDK folder inside the VS2005 directory, whereas there doesn't appear to be any such directory on for MSVC6. Why is this symbol missing? How can I get it? I'm tempted to just copy it across, but who knows what else I'll be missing down the road... Any ideas?
Since Visual Studio .Net 2003, Microsoft change its way to deliver the PlatformSDK. It allows the C/C++ compiler to use PlatformSDK other than the bundled version with VC package.
You could install PlatformSDK for Windows Server 2k3, but The last SDK that will work with VC 6.0 is the February 2003 Edition which is not available from Microsoft website.
So you could simply copy the #define to your code before using SO_EXCLUSIVEADDRUSE. It should work and support by Win2k3.

Resources