Language: C++/CX & XAML
Environment: Visual Studio 2013 on Windows 8.1
I am trying to use the Amazon Product Advertising API in my Windows Store app. I have an Associates account so I am allowed to use this however I'm having problems implementing the .wsdl file after using wsutil.exe to create a .c and .h file for my project.
The .c and .h files both have errors pointing to identifiers that reside inside WebServices.h.
Since the .c and .h files have a combined length of more than 13k lines of code I'll write out steps to reproduce my problem.
-Navigate to http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl
-Save the file either in a project fold or on the desktop
-Open up a VS2013 command prompt and navigate to where the file resides
-Type "wsutil /wsdl:AWSECommerceService.wsdl"
This produces the .c and .h files that can be used in the project
-Add the .c and .h files to a VC++ Windows Store app project
since the environment language is C++/CX and wsutil gave us a .c file we need to tell the compiler to treat this file as a C++ file otherwise if you try to build like it is it throws an error saying:
Command line error D8048: cannot compile C file '....\New folder\AWSECommerceService.wsdl.c' with the /ZW option
My first attempt at trying to fix this was to remove the /ZW option.
This can be done by right clicking the .c file, click properties, under "General" you will will see "yes(/ZW)" which you can change to "no".
after doing this and trying to build it gives this error:
...\awsecommerceservice.wsdl.c : fatal error C1853: 'Debug\SimpleShop.pch' precompiled header file is from a previous version of the compiler, or the precompiled header is C++ and you are using it from C (or vice versa)
That wasn't the correct fix so I went back and added the /ZW option.
Next I decided to tell the compiler to treat the .c file as a .cpp file by adding the /TP option. You can find this by right clicking the .c file, clicking properties, click Advanced, click the drop down box next to "Compile as" and selected /TP.
Now when trying to build the project errors appear in both the .c and .h files for identifiers that reside in the WebServices.h file.
This is where I'm stuck at. I tried to #include "WebServices.h" into the .h file (which is oddly missing it whereas the .c file is not) and this does nothing to remove any of the errors.
I can find nothing about using the Amazon Product Advertising API inside a windows store app on the internet so all of the attempted fixes came from Win7 or WCF forums. The steps I'm trying to follow are from Amazon on they can be found here (focus on step 4):
http://docs.aws.amazon.com/AWSECommerceService/latest/GSG/GettingSetUp.html
these are the errors:
1>c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.h(1037): error C2371: '_RelatedItems::RelatedItemCount' : redefinition; different basic types
1> c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.h(1034) : see declaration of '_RelatedItems::RelatedItemCount'
1>c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.h(1576): error C2061: syntax error : identifier 'WS_SERVICE_SECURITY_CALLBACK'
1>c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.h(1604): error C2061: syntax error : identifier 'WS_SERVICE_SECURITY_CALLBACK'
1>c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.h(1632): error C2061: syntax error : identifier 'WS_SERVICE_SECURITY_CALLBACK'
1>c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.h(1660): error C2061: syntax error : identifier 'WS_SERVICE_SECURITY_CALLBACK'
1>c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.h(1688): error C2061: syntax error : identifier 'WS_SERVICE_SECURITY_CALLBACK'
1>c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.h(1716): error C2061: syntax error : identifier 'WS_SERVICE_SECURITY_CALLBACK'
1>c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.h(1744): error C2061: syntax error : identifier 'WS_SERVICE_SECURITY_CALLBACK'
1>c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.h(1772): error C2061: syntax error : identifier 'WS_SERVICE_SECURITY_CALLBACK'
1>c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.h(1800): error C2061: syntax error : identifier 'WS_SERVICE_SECURITY_CALLBACK'
1>c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.h(1828): error C2061: syntax error : identifier 'WS_SERVICE_SECURITY_CALLBACK'
1>c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.h(1856): error C2061: syntax error : identifier 'WS_SERVICE_SECURITY_CALLBACK'
1>c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.h(2709): error C2146: syntax error : missing ';' before identifier 'AWSECommerceServiceBinding'
1>c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.h(2709): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.c(1159): error C2146: syntax error : missing ';' before identifier 'contractDesc'
1>c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.c(1159): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.c(6674): fatal error C1903: unable to recover from previous error(s); stopping compilation
There are several things going on here:
You need to include the header pch.h at the top of the generated .c file
This sounds like a genuine error in the generated header. Notice a member defined twice.
typedef struct _RelatedItems
{
enum _Relationship Relationship;
WCHAR* RelationshipType;
unsigned __int64 RelatedItemCount;
unsigned __int64 RelatedItemPageCount;
unsigned __int64 RelatedItemPage;
unsigned int RelatedItemCount;
_Field_size_(RelatedItemCount)struct _RelatedItem* RelatedItem;
} _RelatedItems;
The other errors are because the missing identifiers are actually not available for Windows Store apps. Both WS_SERVICE_SECURITY_CALLBACK and WS_CONTRACT_DESCRIPTION are conditionally defined in the SDK header WebServices.h only for Desktop apps
"if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)"
Related
So I'm trying to update a windows build of a project and encountered this error,
1>C:\Program Files (x86)\Windows Kits\8.0\Include\shared\ws2def.h(452): error C2059: syntax error : 'constant'
1>C:\Program Files (x86)\Windows Kits\8.0\Include\shared\ws2def.h(452): error C3805: 'constant': unexpected token, expected either '}' or a ','
I determined that winsock.h must have been included earlier than Winsock2.h which was included in the error'd file so I defined
_WINSOCKAPI_
in the project properties to make sure that didn't happen.
However now I get like 8 other errors from files that include afxsock.h saying "error : MFC requires use of Winsock2.h". So is
_WINSOCKAPI_
preventing afxsock.h from including winsock? Because it seems like I have this circular error and only one set of files can build properly.
I recently tried to write a c++ program, where I used the build in socket tools you can find in the Boost library. First of all, I tried to make a client/server based program, where the server just sends a message and the client receives it. It worked just fine.
Then I wrote another program, where I used a Xbox 360 kinect, to control my movement. The idea of creating the first program, was the get the code for the socket creating, so I can connect with, i.e. my Samsung tv, to control the tv, using my kinect.
The problem arises, when I copy my code from the first program, into my second program with the kinect. All of sudden, the program gives 100+ error, when compiling the boost library.
I triple checked the including libraries and all, but the problem still arises. Some of the errors are posted below:
1>C:\boost_1_55_0b1\boost/asio/detail/socket_types.hpp(96): error C2143: syntax error : missing ';' before '.'
1>C:\boost_1_55_0b1\boost/asio/detail/socket_types.hpp(96): error C2238: unexpected token(s) preceding ';'
1>C:\boost_1_55_0b1\boost/asio/detail/impl/socket_ops.ipp(2224): error C2653: 'Windows' : is not a class or namespace name
1>C:\boost_1_55_0b1\boost/asio/detail/impl/socket_ops.ipp(2224): error C2871: 'Collections' : a namespace with this name does not exist
1>C:\boost_1_55_0b1\boost/asio/detail/impl/socket_ops.ipp(2225): error C2653: 'Windows' : is not a class or namespace name
1>C:\boost_1_55_0b1\boost/asio/detail/impl/socket_ops.ipp(2225): error C2871: 'Networking' : a namespace with this name does not exist
1>C:\boost_1_55_0b1\boost/asio/detail/impl/socket_ops.ipp(2226): error C2653: 'Windows' : is not a class or namespace name
1>C:\boost_1_55_0b1\boost/asio/detail/impl/socket_ops.ipp(2226): error C2871: 'Connectivity' : a namespace with this name does not exist
1>C:\boost_1_55_0b1\boost/asio/detail/impl/socket_ops.ipp(2227): error C2065: 'IVectorView' : undeclared identifier
1>C:\boost_1_55_0b1\boost/asio/detail/impl/socket_ops.ipp(2227): error C2065: 'HostName' : undeclared identifier
1>C:\boost_1_55_0b1\boost/asio/detail/impl/socket_ops.ipp(2227): error C2059: syntax error : '>'
1>C:\boost_1_55_0b1\boost/asio/detail/impl/socket_ops.ipp(2227): error C2653: 'NetworkInformation' : is not a class or namespace name
1>C:\boost_1_55_0b1\boost/asio/detail/impl/socket_ops.ipp(2228): error C2065: 'hostnames' : undeclared identifier
1>C:\boost_1_55_0b1\boost/asio/detail/impl/socket_ops.ipp(2228): error C2227: left of '->Size' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>C:\boost_1_55_0b1\boost/asio/detail/impl/socket_ops.ipp(2230): error C2065: 'HostName' : undeclared identifier
And many many others. I know by the fact, that the libraries work. It worked in the first program, so I just can't figure out what's causing the problem.
Other includes are the SDL and SDK for Kinect libraries for c++.
I just came across this too. I found by adding the "/P" option to the C++ compiler options in Visual Studio and recompiling the file that failed, that s_addr was indeed getting #defined.
The offending header was part of the Windows SDK inaddr.h, which is included in the header chain of winsock.h.
The offending line in the header was:
#define s_addr S_un.S_addr
More information about this header is on MSDN here.
The fix I found was to #undef s_addr just before the #include of the BOOST ASIO header.
I would like to create a project use to call c++ method using c#. So, I need to create a dll file for all of my c++ function. But when i get an error in y sqlite source code such as "AreFileApisASNSI undeclared identifier". So, i import winbase.h which is part of the mingw-w64 runtime package to my visual studio 2012 express DLL project. After import the file, I get many errors such as below:-
error c4430: missing type specifier - int assumed. Note: C++ does not support default - int
error C2143: syntax error : missing ';' before '_stdcall'
error c1003 error count exceeds 100; stopping compilation
error c2061: syntax error: identifier ' WINBOOL'
error c2086: 'int_CRT_INLINE' : redefinition
error c2143: syntax error: missing ';' before ''
error C2146: syntax error : missing ';' before identifier 'LONGLONG'
error C2146: syntax error : missing ';' before identifier 'PVOID'
any solution for those error? please help!!
The documentation for the function has this header requirement:
WinBase.h (include Windows.h)
This is telling you that the function is declared in WinBase.h, but that you should include Windows.h which in turn will include WinBase.h. So, you need to change your include to
#include <Windows.h>
I also wonder why you are talking about mingw considering that your compiler is MSVC. That compiler ships with a comprehensive Windows SDK. Why would you be using an SDK from mingw?
I'm using the WTTLogger (downloaded from WLK- windows logo kit) in my c++ application. I don't get any compilation/linker errors with an older version of wtt library WTTLog.DLL/lib and WTTlogger.h header file.
But with a latest version of the header file and library , I'm getting the following error in the header file
This is a Microsoft given header file and I'm not able to understand this error in the microsoft given header file. Any inputs would be greatly appreciated.
::
error C2061: syntax error : identifier 'WTTMetadataDefinition'
error C2061: syntax error : identifier 'WTTMetadataReference'
error C2061: syntax error : identifier 'WTTMetadataDefinition'
error C2061: syntax error : identifier 'WTTMetadataReference'
Trying to build a legacy code in VS2005 and get errors in VC header files.
d:\Compilers\Microsoft Visual Studio 8\VC\include\xutility(2096) : error C2065: '_Sb' : undeclared identifier
d:\Compilers\Microsoft Visual Studio 8\VC\include\xutility(2176) : see reference to class template instantiation 'std::istreambuf_iterator<_Elem,_Traits>' being compiled
d:\Compilers\Microsoft Visual Studio 8\VC\include\xutility(2096) : error C3861: '_Strbuf': identifier not found
d:\Compilers\Microsoft Visual Studio 8\VC\include\xutility(2096) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\Compilers\Microsoft Visual Studio 8\VC\include\xutility(2096) : error C2061: syntax error : identifier '_Sb'
d:\Compilers\Microsoft Visual Studio 8\VC\include\xutility(2097) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\Compilers\Microsoft Visual Studio 8\VC\include\xutility(2098) : error C2143: syntax error : missing ';' before '{'
d:\Compilers\Microsoft Visual Studio 8\VC\include\xutility(2098) : error C2334: unexpected token(s) preceding '{'; skipping apparent function body
d:\Compilers\Microsoft Visual Studio 8\VC\include\xutility(2176) : fatal error C1075: end of file found before the left brace '{' at 'd:\Compilers\Microsoft Visual Studio 8\VC\include\xutility(15)' was matched
I find the legacy code uses a vector and if I comment out those variables then the code compiles without any errors.
I get these errors even if I just include vector header without defining any variable.
All the files in the project are cpp files.
Do I need to add some preprocessor directives or compiler settings to get this working?
You may find that running the pre-process phase on one of the files might show if any macros are being expanded that conflict with vector or _Strbuf. See my post on how to do this:
Compiling a project (VS 2008) with the /p argument (preprocess to a file) doesn't compile
You probably need to remove some conflicting predefined macros. Leading underscores followed by uppercase letters, as in _Sb are reserved for the implementation. If you have that defined as something else, you'll get such errors. It's also possible the errors are because you've defined _Strbuf ot _Got.