Problem: Compiling the REST SDK on XP with VS2010

Nov 14, 2013 at 11:50 PM
Edited Nov 15, 2013 at 12:10 AM
I have problems building REST on XP with VS2010.

According to this https://casablanca.codeplex.com/workitem/25 support for windows XP have been implemented. Maybe I need to download the binaries, and they will work on xp, but building REST wont? Anyways.

I hope someone can give me some hints on how to succeed with building REST on XP. If this is not possible, and it is only the binaries that can be downloaded and used on XP, then please let me know. Any help is welcome :)

This is what I did:

1) I downloaded and installed VS2010 (because that's the latest version that works on XP afaik).
2) Downloaded the REST SDK source with GIT
3) Followed the instructions from https://casablanca.codeplex.com/wikipage?title=Build%20and%20Setup%20on%20Windows&referringTitle=Documentation

First problem I noticed, was that the instructions state that 'the Windows Phone 8 SDK installed.'. But according to the web page for the phone SDK it says 'requirements: Supported Operating System: Windows 8, Windows 8 Pro'.

I thought, hmmm. And why do I need the phone SDK? So I tried to build without downloading and installing the phone SDK.

Next problem I noticed was that the build instructions says to create a directory Cpp-REST-SDK and change to it and then download with git to 'NameOfFolder'. This would in effect create the release build command files in: Cpp-REST-SDK\NameOfFolder\Release, but later in the instructions it says 'cd Cpp-REST-SDK/Release' followed by 'MSbuild dirs.proj'. Hmmmm, this wont work, because if have done as described, the Release directory will be located in 'cd Cpp-REST-SDK/NameOfFolder/Release'.

Then I noticed that it isn't clearly described what DevToolsVersion should be set to. Must it be set to 100 for VS2010?

Ah well, I thought, probably some typos. So. This is what I did in more detail:

1) Opened a normal command prompt
2) cd [snip]\Visual Studio 2010\Projects\
3) git clone https://git01.codeplex.com/casablanca casablanca
4) Closed the command prompt and opened a visual studio command prompt
5) cd [snip]\Visual Studio 2010\Projects\casablanca\Release
6) set DevToolsVersion=100
7) MSbuild dirs.proj

The build failed, and produced the following error message (I have only extracted the error messages and I have shortened the path to the project to make it easier to read:

authentication_tests.obj : error LNK2019: unresolved external symbol __imp__WinHttpSetOption@16 referenced in function "public: void __thiscall tests::functional::http::client::Suiteauthentication_tests::`anonymous namespace'::<lambda118>::operator()(void *)const " (??R<lambda118>@?A0x33193523@Suiteauthentication_tests@client@http@functional@tests@@QBEXPAX@Z) [[snip]\Visual Studio 2010\Projects\casablanca\Release\tests\Functional\http\client\VS10\HttpClient100_test.vcxproj]
[snip]\Visual Studio 2010\Projects\casablanca\Binaries\Win32\Debug\HttpClient100_test.dll : fatal error LNK1120: 1 unresolved externals [[snip]\Visual Studio 2010\Projects\casablanca\Release\tests\Functional\http\client\VS10\HttpClient100_test.vcxproj]

[snip]\visual studio 2010\projects\casablanca\release\tests\functional\misc\atl_headers\header_test2.cpp(38): fatal error C1083: Cannot open include file: 'afx.h': No such file or directory [[snip]\Visual Studio 2010\Projects\casablanca\Release\tests\Functional\misc\atl_headers\VS10\header_test100.vcxproj]

[snip]\visual studio 2010\projects\casablanca\release\tests\functional\misc\atl_headers\header_test1.cpp(36): fatal error C1083: Cannot open include file: 'afx.h': No such file or directory [[snip]\Visual Studio 2010\Projects\casablanca\Release\tests\Functional\misc\atl_headers\VS10\header_test100.vcxproj]

[snip]\Visual Studio 2010\Projects\casablanca\Build\Common.Build.Traversal.targets(18,5): error MSB3202: The project file "BlackJack_Client100\BlackJack_Client100.vcxproj" was not found. [[snip]\Visual Studio 2010\Projects\casablanca\Release\samples\BlackJack\BlackJack_Client\dirs.proj]

Build FAILED.

"[snip]\Visual Studio 2010\Projects\casablanca\Release\dirs.proj" (default target) (1) ->
"[snip]\Visual Studio 2010\Projects\casablanca\Release\tests\dirs.proj" (Build target) (4) ->
"[snip]\Visual Studio 2010\Projects\casablanca\Release\tests\Functional\dirs.proj" (Build target) (13) ->
"[snip]\Visual Studio 2010\Projects\casablanca\Release\tests\Functional\http\dirs.proj" (Build target) (14) ->
"[snip]\Visual Studio 2010\Projects\casablanca\Release\tests\Functional\http\client\dirs.proj" (Build target) (17) ->
"[snip]\Visual Studio 2010\Projects\casablanca\Release\tests\Functional\http\client\VS10\HttpClient100_test.vcxproj" (Build target) (19) ->
(Link target) ->
authentication_tests.obj : error LNK2019: unresolved external symbol __imp__WinHttpSetOption@16 referenced in function "public: void __thiscall tests::functional::http::client::Suiteauthentication_tests::`anonymous namespace'::<lambda118>::operator()(void *)const " (??R<lambda118>@?A0x33193523@Suiteauthentication_tests@client@http@functional@tests@@QBEXPAX@Z) [[snip]\Visual Studio 2010\Projects\casablanca\Release\tests\Functional\http\client\VS10\HttpClient100_test.vcxproj]
[snip]\Visual Studio 2010\Projects\casablanca\Binaries\Win32\Debug\HttpClient100_test.dll : fatal error LNK1120: 1 unresolved externals [[snip]\Visual Studio 2010\Projects\casablanca\Release\tests\Functional\http\client\VS10\HttpClient100_test.vcxproj]


"[snip]\Visual Studio 2010\Projects\casablanca\Release\dirs.proj" (default target) (1) ->
"[snip]\Visual Studio 2010\Projects\casablanca\Release\tests\dirs.proj" (Build target) (4) ->
"[snip]\Visual Studio 2010\Projects\casablanca\Release\tests\Functional\dirs.proj" (Build target) (13) ->
"[snip]\Visual Studio 2010\Projects\casablanca\Release\tests\Functional\misc\dirs.proj" (Build target) (24) ->
"[snip]\Visual Studio 2010\Projects\casablanca\Release\tests\Functional\misc\atl_headers\dirs.proj" (Build target) (25) ->
"[snip]\Visual Studio 2010\Projects\casablanca\Release\tests\Functional\misc\atl_headers\VS10\header_test100.vcxproj" (Build target) (26) ->
(ClCompile target) ->
[snip]\visual studio 2010\projects\casablanca\release\tests\functional\misc\atl_headers\header_test2.cpp(38): fatalerror C1083: Cannot open include file: 'afx.h': No such file or directory [[snip]\Visual Studio 2010\Projects\casablanca\Release\tests\Functional\misc\atl_headers\VS10\header_test100.vcxproj]
[snip]\visual studio 2010\projects\casablanca\release\tests\functional\misc\atl_headers\header_test1.cpp(36): fatalerror C1083: Cannot open include file: 'afx.h': No such file or directory [[snip]\Visual Studio 2010\Projects\casablanca\Release\tests\Functional\misc\atl_headers\VS10\header_test100.vcxproj]


"[snip]\Visual Studio 2010\Projects\casablanca\Release\dirs.proj" (default target) (1) ->
"[snip]\Visual Studio 2010\Projects\casablanca\Release\samples\dirs.proj" (Build target) (37) ->
"[snip]\Visual Studio 2010\Projects\casablanca\Release\samples\BlackJack\dirs.proj" (Build target) (40) ->
"[snip]\Visual Studio 2010\Projects\casablanca\Release\samples\BlackJack\BlackJack_Client\dirs.proj" (Build target) (4
1) ->
(Build target) ->
[snip]\Visual Studio 2010\Projects\casablanca\Build\Common.Build.Traversal.targets(18,5): error MSB3202: The project file "BlackJack_Client100\BlackJack_Client100.vcxproj" was not found. [[snip]\Visual Studio 2010\Projects\casablanca\Release\samples\BlackJack\BlackJack_Client\dirs.proj]


"[snip]\Visual Studio 2010\Projects\casablanca\Release\dirs.proj" (default target) (1) ->
"[snip]\Visual Studio 2010\Projects\casablanca\Release\samples\dirs.proj" (Build target) (37) ->
"[snip]\Visual Studio 2010\Projects\casablanca\Release\samples\BlackJack\dirs.proj" (Build target) (40) ->
"[snip]\Visual Studio 2010\Projects\casablanca\Release\samples\BlackJack\BlackJack_Server\dirs.proj" (Build target) (4
2) ->
[snip]\Visual Studio 2010\Projects\casablanca\Build\Common.Build.Traversal.targets(18,5): error MSB3202: The project file "BlackJack_Server100\BlackJack_Server100.vcxproj" was not found. [[snip]\Visual Studio 2010\Projects\casablanca\Release\samples\BlackJack\BlackJack_Server\dirs.proj]
0 Warning(s)
6 Error(s)

Nov 15, 2013 at 1:26 AM
Edited Nov 15, 2013 at 1:27 AM
Hi casablancanoob:

Thanks for your problems. Unfortunately, we do not support building our REST project on XP machine and the targeting XP binaries supports vs2012 only.
You need to install vs2012 with update3, set the platform toolset v110_xp, link the cpprest_xp_1_3.lib and use the cpprest110_xp_1_3.dll to build your targeting XP projects.

For your first problem "the instructions state that 'the Windows Phone 8 SDK installed", you do not need to install Windows Phone 8 SDK since you are using vs2010.

For your second problem, you are correct. The Release directory will be located in 'cd Cpp-REST-SDK/NameOfFolder/Release'; we will update the instructions.


For your building errors:
  1. error LNK2019: unresolved external symbol __imp__WinHttpSetOption: Since you are building on XP and we never build the project on XP machines, I guess possibly you need to install the winhttp 5.1 sdk.
    http://msdn.microsoft.com/en-us/library/windows/desktop/aa384086(v=vs.85).aspx
  2. Cannot open include file: 'afx.h': You need to install visual studio professional or above edition, the express edition does not provide any MFC/ATL support.
  3. BlackJack_Client100\BlackJack_Client100.vcxproj" was not found: BlackJack sample does not support vs2010.
Thanks
Nov 15, 2013 at 4:20 PM
Edited Nov 15, 2013 at 4:38 PM
Thank you very much for your reply.

I still have a few question that I am uncertain about. Below I am going to ask 3 questions. Before I ask the 3 questions, be aware that specifying the name of the OS is not enough. You must specify if it needs to be standard, pro or ultimate if it's windows. Also, if I can use the lib on linux/bsd (what version?), that would be nite to know some details about. The same for the compiler. What compiler can I use/do I need? Fx, as mentioned above, it's not enough to install VS Express, you must use VS Pro. So saying 'VS 2010' is not enough, you must specify fx,'VS 2012 Pro'. Fx, can I use Clang for windows with the REST SDK binaries to build applicaitons using REST? Can I use Clang to build the REST source? And finaly does the binaries run on windows XP fx (I think you answered this above). If you care to comment on this then please do.

Here comes the question

1) What do I need to compile the REST SDK?
Which OS do I need? Which compilers can I use/do I need? What third party tools/libs do I need?

2) What do I need to use the compiled REST SDK and build applications with it?
What OS do I need? Which compilers can I use with the REST SDK binaries. What third party tools/libs do I need?

3) What do I need to use the compiled applications using the REST SDK.
What OS do I need? What third party tools/libs do I need?

I have not been able to convince myself of exactly what works (build sdk, build app, use app), based on the documentation on the site. I hope I have not missed this information and am asking like a jerk/troll - this is not my intention. I hope you will help clarify the 3 points mentioned in this post.

NOTES:

My background is, that I am currently investigating if I should/can use VSC Express and auxiliaries to build and use applications for json based client/services on Windows XP or if I should use linux or bsd and Clang and boost to build applications for json based client/severs. Or maybe if I can use VSC Express and Boost and auxilaries (fx rapidjson) to build and use them on windows XP. My interests are not commercial, I want to create a private project and release it for free (free to use and modify). Or must I dig out my old socket code and openssl and ignore all the modern stuff :)
Nov 15, 2013 at 4:52 PM
Hi casablancanoob,

Sorry for the confusion here. Let me try and clear everything up for you. You have quite a lot of questions so let me try my best. In general if you are targeting any of the Microsoft platforms you can just use the binaries we distribute in our MSIs.
  1. Don't compile the Rest SDK if you don't need to. Try to use our MSI or Nuget packages if you can. We support compiling the Rest SDK on Windows 7, 8, 8.1, and Ubuntu. Here are some links for building on Windows and on Linux. If you build on Windows all you need is Visual Studio 2012 or 2013.
  2. The Rest SDK supports running on XP, Vista, Windows 7, 8, 8.1 desktop, store, Windows 8 Phone, and Ubuntu. To use the C++ Rest SDK you just need to setup the header file includes, link to the lib, and have the dll present to execute.
  3. This question seems to be the same as the others.
Here is my suggestion:
  1. Download and install our MSI for VS 2012.
  2. Setup the include path for your application. The headers will be located C:\Program Files (x86)\Microsoft Cpp REST SDK for VS 2012 v1.3\SDK\include.
  3. Setup you application to link to cpprestd_xp_1_3.lib. Libs can be found in C:\Program Files (x86)\Microsoft Cpp REST SDK for VS 2012 v1.3\SDK\lib\x86\Debug.
  4. Make sure to have the cpprest110d_xp_1_3.dll present during execution. Dlls are under C:\Program Files (x86)\Microsoft Cpp REST SDK for VS 2012 v1.3\SDK\bin\x86\Debug.
You can also take a look at our samples to get started. The BingRequest sample works on XP. In the future we will add XP targeting support to our Nuget package and that will make things easier.

Thanks,
Steve
Nov 15, 2013 at 9:40 PM
Download and install our MSI for VS 2012
But VS 2012 does not install on Windows XP. The latest version of Visual Studio that can be installed on Windows XP is VS 2010:

http://www.microsoft.com/visualstudio/eng/products/compatibility

According to what I've been able to find on the web, searching for 'vs 2012 windows xp' is that you can not install VS 2012 on windows XP, you can only compile programs to target the windows xp platform, but you need windows 7 or better to install VS 2012.

So I guess I will have to use Ubuntu if I want to test the REST SDK.
Nov 16, 2013 at 1:03 AM
Hi casablancanoob,

Ah yes you are correct. We don't support doing the actual development on Windows XP, we only support targeting XP. If you want to run on XP you will have to use a newer Windows version for the development.

Steve