undeclared identifier SO_EXCLUSIVEADDRUSE when building Apache Axis2/C - visual-studio

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.

Related

dll library with cpprestsdk compilation on windows xp

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

Build ATL VS2010 project on CI server

I need to build VS2010 C++ ATL project on CI server with no VS2010 installed.
The project can be successfully built on developers machine with VS2010 installed. But VS2010 cannot be installed to CI servers because that requires a license.
So, for now I'm trying the following approach:
Installed VS2010 Express
Installed Microsoft Windows SDK for Windows 7
Installed Windows Driver Kit (it includes ATL and MFC)
Although I have ATL headers and libs installed on the CI machine, I'm getting the following errors:
error C2039: 'AtlSetPerUserRegistration' : is not a member of 'ATL'
error C3861: 'AtlSetPerUserRegistration': identifier not found
I compared atlbase.h headers from VS2010 installation and from WDK. They are different:
- atlbase.h from VS2010 installation does have AtlSetPerUserRegistration definition;
- atlbase.h from WDK installation does not have it.
That causes an error mentioned above.
The question is: how to configure CI build machine for building ATL projects without installing VS2010?
Update:
Checking atldef.h file I found the following:
VS2010 version has the line:
#define _ATL_VER 0x0A00 // Active Template Library version 10.00
and WDK version has the line:
#define _ATL_VER 0x0800 // Active Template Library version 8.00
So, WDK ATL version differs from the VS2010 ATL version. That's why they're not 100% compatible.
Now the question is: How to get ATL v10.0 on the build server without having VS2010 installed?
In case if anyone else meets the same issue, here is a workaround:
The required version of ATL is available on developers machine with VS2010 installed (e.g. VS2010 Professional).
It is located in the folder %VCINSTALLDIR%ATLMFC.
By default it is c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\
Folder ATLMFC can be copied to the build server by hands into %VCINSTALLDIR%, where VS2010 Express is installed. And that makes build server able to build VS2010 ATL projects without installing VS2010.
Though this is a workaround. And I'd like to see better solution if any. So, I'm not accepting my answer.

“MSVCP100.dll is either not designed to run on Windows or it contains an error”

I built an application in C++ using Visual Studio 2010 Express. When I tried to run it on a certain computer today I got this error:
MyApplication.exe - Bad Image
C:\Path to My Application\MSVCP100.dll is either not designed to run on Windows or it contains an error. Try installing the program again using the original installation media or contact your system administrator or the software vendor for support.
The DLL mentioned is one of the Visual C++ Redistributable DLLs. My application’s installer used to launch Microsoft’s installer for those DLLs but I recently tweaked it just to install msvcp100.dll and msvcr100.dll alongside my application. The new way worked fine on a handful of other computers, though I can’t rule out the possibility that that was only because the DLLs had already been installed at system level on those other computers.
What is causing this sudden DLL mismatch?
That's STATUS_INVALID_IMAGE_FORMAT, the Machine property in the DLL header doesn't match the architecture of the application.
Do keep in mind that you are likely to have two copies of this DLL on your build machine, the x86 and the x64 version. Later versions of VS have a 3rd copy, the ARM version. So very high odds that you picked the wrong one. Usually you'd target x86, the one you tested your program with is stored in the c:\windows\syswow64 directory. The 64-bit version is in c:\windows\system32.
How these directories got these seemingly backward names is a story for another day :) Favor using the vc/redist subdirectory of the VS install directory as a source for the copy, it is less ambiguous.
This .dll file is related to the Microsoft Visual C++ 2010 Redistributable x64 Package.
Try removing the Microsoft Visual C++ 2010 Redistributable x64 Package by using the Add or Remove Programs item in Control Panel.
Then, install the latest version Visual C++ (file name= vcredist_x64.exe) from the site:
http://www.microsoft.com/en-us/download/details.aspx?id=26999
Hope that helped..
If all above suggested solutions not worked for you than download MSVCR100.dll 32 bit or 64 bit as per your system configuration.
Download DLL from below link
https://www.sts-tutorial.com/sites/downloadCenter.php?MSVCR100
Follow da steps
1.Download the dll from here
https://www.sts-tutorial.com/sites/downloadCenter.php?MSVCR100
2.open with winrar
3.Extract MSVCR100.dll to C:\Windows\System32
hope it will work c:

Deploy mixed code Visual Studio application

I have a problem running my application on other machines.
I am developing with Visual Studio 2008 in a Win7 x64 machine.
The solution contains several C# projects (the main application is written in C#, all others are library projects) and two c++/CLI libraries. The C++ libraries are Win32 and all C# projects are set to x86 target processor. No third party libraries used. Framework used is v3.5.
The application builds and runs fine on my machine.
I copied the whole "bin\release" folder to a Win7 x86 machine and it ran fine, too.
But when I tried on a XP x86 system, it did not start. No error message, not even showing up shortly in the task manager. The XP system has all updates installed, all available .NET frameworks installed and all Visual Studio Runtimes installed.
I checked with DependencyWalker and the only missing dlls are "IEShim.dll" and "wer.dll" which are only for Vista or higher.
I tried another of my applications that's not using C++ libraries and they work fine. So I guess I am doing something wrong deploying the C++ dlls.
Registering the C++ dlls with "regsvr32" failed with a "DllEntryPoint" not found message. Registering with "regasm" was successful, but had no effect.
What is it that I am missing?
Well, seems like I was a bit hasty stating "no third party components".
Actually it was the SQL Server Compact who was missing its runtime.

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.

Resources