CPP Rest SDK, Build errors while building my project

Jun 10, 2014 at 4:21 PM
Hello,

After I added CPP Rest SDK to my project (C++ project) using NuGet in Visual Studio 2010, I tried to build my project, but i get the following errors in streams.h file

Error 117 error C2065: 'INT8_MIN' : undeclared identifier <projectLocation>\build\packages\cpprestsdk.2.0.1\build\native\include\cpprest\streams.h 451
Error 118 error C2057: expected constant expression <projectLocation>\build\packages\cpprestsdk.2.0.1\build\native\include\cpprest\streams.h 451
Error 119 error C2065: 'INT8_MAX' : undeclared identifier <projectLocation>\build\packages\cpprestsdk.2.0.1\build\native\include\cpprest\streams.h 451
Error 120 error C2057: expected constant expression <projectLocation>\build\packages\cpprestsdk.2.0.1\build\native\include\cpprest\streams.h 451
Error 121 error C2065: 'INT8_MIN' : undeclared identifier <projectLocation>\build\packages\cpprestsdk.2.0.1\build\native\include\cpprest\streams.h 452
Error 122 error C2057: expected constant expression <projectLocation>\build\packages\cpprestsdk.2.0.1\build\native\include\cpprest\streams.h 452
Error 123 error C2065: 'INT8_MAX' : undeclared identifier <projectLocation>\build\packages\cpprestsdk.2.0.1\build\native\include\cpprest\streams.h 452
Error 124 error C2057: expected constant expression <projectLocation>\build\packages\cpprestsdk.2.0.1\build\native\include\cpprest\streams.h 452
Error 125 error C2065: 'INT16_MIN' : undeclared identifier <projectLocation>\build\packages\cpprestsdk.2.0.1\build\native\include\cpprest\streams.h 453
Error 126 error C2057: expected constant expression <projectLocation>\build\packages\cpprestsdk.2.0.1\build\native\include\cpprest\streams.h 453
Error 127 error C2065: 'INT16_MAX' : undeclared identifier <projectLocation>\build\packages\cpprestsdk.2.0.1\build\native\include\cpprest\streams.h 453
Error 128 error C2057: expected constant expression <projectLocation>\build\packages\cpprestsdk.2.0.1\build\native\include\cpprest\streams.h 453
Error 129 error C2065: 'INT16_MIN' : undeclared identifier <projectLocation>\build\packages\cpprestsdk.2.0.1\build\native\include\cpprest\streams.h 454
Error 130 error C2057: expected constant expression <projectLocation>\build\packages\cpprestsdk.2.0.1\build\native\include\cpprest\streams.h 454
Error 131 error C2065: 'INT16_MAX' : undeclared identifier <projectLocation>\build\packages\cpprestsdk.2.0.1\build\native\include\cpprest\streams.h 454
Error 132 error C2057: expected constant expression <projectLocation>\build\packages\cpprestsdk.2.0.1\build\native\include\cpprest\streams.h 454
Error 133 error C2065: 'INT32_MIN' : undeclared identifier <projectLocation>\build\packages\cpprestsdk.2.0.1\build\native\include\cpprest\streams.h 455
Error 134 error C2057: expected constant expression <projectLocation>\build\packages\cpprestsdk.2.0.1\build\native\include\cpprest\streams.h 455
Error 135 error C2065: 'INT32_MAX' : undeclared identifier <projectLocation>\build\packages\cpprestsdk.2.0.1\build\native\include\cpprest\streams.h 455
Error 136 error C2057: expected constant expression <projectLocation>\build\packages\cpprestsdk.2.0.1\build\native\include\cpprest\streams.h 455
Error 137 error C2065: 'UINT8_MAX' : undeclared identifier <projectLocation>\build\packages\cpprestsdk.2.0.1\build\native\include\cpprest\streams.h 458
Error 138 error C2057: expected constant expression <projectLocation>\build\packages\cpprestsdk.2.0.1\build\native\include\cpprest\streams.h 458
Error 139 error C2065: 'UINT16_MAX' : undeclared identifier <projectLocation>\build\packages\cpprestsdk.2.0.1\build\native\include\cpprest\streams.h 459
Error 140 error C2057: expected constant expression <projectLocation>\build\packages\cpprestsdk.2.0.1\build\native\include\cpprest\streams.h 459
Error 141 error C2065: 'UINT32_MAX' : undeclared identifier <projectLocation>\build\packages\cpprestsdk.2.0.1\build\native\include\cpprest\streams.h 460
Error 142 error C2057: expected constant expression <projectLocation>\build\packages\cpprestsdk.2.0.1\build\native\include\cpprest\streams.h 460
Error 143 error C1189: #error : "Error: http server APIs are not supported in XP" <projectLocation>\build\packages\cpprestsdk.2.0.1\build\native\include\cpprest\http_listener.h 32


I don't know how to fix that problem, what am I missing here ?? I tried searching online, but I didn't find anything useful, I searched the "Discussions" but also couldn't find something useful about that problem?

Please reply ASAP, thanks a lot
Coordinator
Jun 10, 2014 at 4:26 PM
Hi mohamedselim,

We don't support Visual Studio 2010 any more, only 2012 and 2013. If you can't upgrade to a newer version of Visual Studio yet you can use an older version of the C++ Rest SDK. The last release we had with Visual Studio 2010 support was 1.2. We've made lots of improvements to the library so I highly recommend you update to a newer version of Visual Studio if possible.

Thanks,
Steve
Jun 10, 2014 at 4:42 PM
Hi Steve,

Thanks for your "fast" reply, appreciated. I removed the latest version using NuGet.

I installed version 1.2, added the include folder to my additional include directories, however, I'm still getting the same errors. Any idea ?

Thanks,
Mohamed
Coordinator
Jun 10, 2014 at 5:20 PM
Hi Mohamed,

Can you please give step by step instructions starting from the beginning so I can try on a machine?

Thanks,
Steve
Jun 10, 2014 at 5:29 PM
Hi Steve,

Sure, here are the steps:
  1. Downloaded the installation file C++ REST SDK for Visual Studio 2010 from the link you provided
  2. Added the include directory "C:\Program Files (x86)\Microsoft Cpp REST SDK for VS 2010 v1.2\SDK\include" to the additional includes in the C/C++ property page of my project
  3. Right Click on my project, Build (I also tried "Rebuild", and "Clean" then "Build")
  4. I got the errors in the Visual Studio 2010
Coordinator
Jun 10, 2014 at 5:38 PM
Hi Mohamed,

From your last error message "Error 143 error C1189: #error : "Error: http server APIs are not supported in XP" ", you are trying to target XP or building on XP. Possibly you use the wrong .dll file.
Jun 10, 2014 at 7:24 PM
Hi,

Now I installed visual studio 2012, and I'm still getting the same errors, here is a screen shot of what i get.

I just installed it using NuGet on Visual Studio 2012, this is weird !!!

Thanks,
Mohamed
Jun 10, 2014 at 7:25 PM
zhelu wrote:
Hi Mohamed,

From your last error message "Error 143 error C1189: #error : "Error: http server APIs are not supported in XP" ", you are trying to target XP or building on XP. Possibly you use the wrong .dll file.
No, no windows XP is included at all. it is weird I'm getting that error
Coordinator
Jun 13, 2014 at 9:37 PM
Hi Mohamed,

I tried the steps you mentioned but our sample applications build just fine with VS2012 + Update 4 (latest). We will need more information on what code snippet you are trying to compile, what else is included in the project.
We just released 2.1 version of our SDK. Could you give it a shot.

Here are the steps I followed:
  1. Create a default Win32 Console Application.
  2. Reference the C++ REST 2.1 Nuget Package.
  3. Compile the app, source looks like:
#include "stdafx.h"
#include <cpprest\streams.h>

int _tmain(int argc, _TCHAR* argv[])
{
    return 0;
}
Are the above three steps working for you?

Thanks
Kavya
Jun 17, 2014 at 1:10 PM
Hi Kavya,

Yes these steps work, I have to check my other project's configuration, there has to be a problem that causes these errors in streams.h

Thanks
Mohamed
Coordinator
Jun 17, 2014 at 4:05 PM
Do let us know if you narrow down what settings result in the compile error. We can then investigate if it is a Casablanca bug or not.

Thanks
Kavya