After including #include <atlbase.h> I am getting error C2632
-
After including
#include
. Please suggest 2>C:\Program Files\Microsoft SDKs\Windows\v6.0A\\include\rpcndr.h(154) : warning C4114: same type qualifier used more than once 2>C:\Program Files\Microsoft SDKs\Windows\v6.0A\\include\rpcndr.h(154) : error C2632: 'char' followed by 'char' is illegal 2>C:\Program Files\Microsoft SDKs\Windows\v6.0A\\include\rpcndr.h(154) : warning C4091: 'typedef ' : ignored on left of 'unsigned char' when no variable is declared
-
After including
#include
. Please suggest 2>C:\Program Files\Microsoft SDKs\Windows\v6.0A\\include\rpcndr.h(154) : warning C4114: same type qualifier used more than once 2>C:\Program Files\Microsoft SDKs\Windows\v6.0A\\include\rpcndr.h(154) : error C2632: 'char' followed by 'char' is illegal 2>C:\Program Files\Microsoft SDKs\Windows\v6.0A\\include\rpcndr.h(154) : warning C4091: 'typedef ' : ignored on left of 'unsigned char' when no variable is declared
Such things may happen when including header files in the wrong order, required header files has not been loaded, or are skipped due to exclusions. Because we don't know the other headers file that might be involved, it can't be answered for now. A common problem is the inclusion of winsock2.h. This must be included before windows.h. I mention it here beacuse RPC is network related. If this does not help you should try to find out the correct order by inspecting the header file inclusion tree. You can generate an include file tree by editing your project settings (Configuration Properties - C/C++ - Advanced - Show Includes). Inspect the line of error (154 in rpcnhdr.h) to know which definitions trigger the error. Then try to find these definitions in header files included before that.
-
Such things may happen when including header files in the wrong order, required header files has not been loaded, or are skipped due to exclusions. Because we don't know the other headers file that might be involved, it can't be answered for now. A common problem is the inclusion of winsock2.h. This must be included before windows.h. I mention it here beacuse RPC is network related. If this does not help you should try to find out the correct order by inspecting the header file inclusion tree. You can generate an include file tree by editing your project settings (Configuration Properties - C/C++ - Advanced - Show Includes). Inspect the line of error (154 in rpcnhdr.h) to know which definitions trigger the error. Then try to find these definitions in header files included before that.
Thanks you for response. Basically I was trying to use ATL in non-ATL application.. Please advise the line 154 in rpcnhdr.h is
typedef unsigned char byte;
-
Thanks you for response. Basically I was trying to use ATL in non-ATL application.. Please advise the line 154 in rpcnhdr.h is
typedef unsigned char byte;
When you use ATL, then your application is not a non-ATL one. The first error message is "same type qualifier used more than once". So
byte
has been already defined. The next one "'char' followed by 'char' is illegal" indicates thatbyte
has been probably defined using a#define
statement so that the compiler seestypedef unsigned char char;
The third error is just based on the previous one. So the goal is to find the previous definition of
byte
and check if the definition can be suppressed or the header file containing it might be included later. That might be some work because atlbase.h includes a lot of other files. I did a quick search but did not found it. But you should better perform this search with your files because they may change with the Visual Studi and the SDK versions. -
When you use ATL, then your application is not a non-ATL one. The first error message is "same type qualifier used more than once". So
byte
has been already defined. The next one "'char' followed by 'char' is illegal" indicates thatbyte
has been probably defined using a#define
statement so that the compiler seestypedef unsigned char char;
The third error is just based on the previous one. So the goal is to find the previous definition of
byte
and check if the definition can be suppressed or the header file containing it might be included later. That might be some work because atlbase.h includes a lot of other files. I did a quick search but did not found it. But you should better perform this search with your files because they may change with the Visual Studi and the SDK versions.Thanks for response. Actual I had a non ATL C++ application, to which I need to add Text to speech(https://msdn.microsoft.com/en-us/library/jj127898.aspx[^]), and hence I was trying to add
#include extern CComModule _Module;
#includeAnd there by started with this issue.