Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My application came out with the following compilation errors.The errors show that the problem is the arrangement of my header files. Please which is the right the right way to arrange header files in my appliction considering the following error messages. Please note that I did not include any of the shown header files in my appliction. The must been included in one or more of the main header files I have inculuded in my application. I believe the conflicting heaeders are the following located in winmain:

#include  <Windows.h>
#include  <gdiplus.h>
#include <Commctrl.h>


and

#include <Gdiplus.h>
#include <gdiplusheaders.h>
#include <string>


that is located in another file

1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(203,14): error C2872: 'byte': ambiguous symbol
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(202,23): message : could be 'unsigned char byte'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstddef(29,24): message : or       'std::byte'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(975,25): error C2872: 'byte': ambiguous symbol
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(202,23): message : could be 'unsigned char byte'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstddef(29,24): message : or       'std::byte'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(983,25): error C2872: 'byte': ambiguous symbol
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(202,23): message : could be 'unsigned char byte'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstddef(29,24): message : or       'std::byte'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\wtypesbase.h(447,26): error C2872: 'byte': ambiguous symbol
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(202,23): message : could be 'unsigned char byte'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstddef(29,24): message : or       'std::byte'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\wtypesbase.h(472,26): error C2872: 'byte': ambiguous symbol
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(202,23): message : could be 'unsigned char byte'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstddef(29,24): message : or       'std::byte'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\wtypesbase.h(489,26): error C2872: 'byte': ambiguous symbol
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(202,23): message : could be 'unsigned char byte'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstddef(29,24): message : or       'std::byte'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\wtypes.h(85,26): error C2872: 'byte': ambiguous symbol
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(202,23): message : could be 'unsigned char byte'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstddef(29,24): message : or       'std::byte'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\wtypes.h(94,26): error C2872: 'byte': ambiguous symbol
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(202,23): message : could be 'unsigned char byte'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstddef(29,24): message : or       'std::byte'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\wtypes.h(100,26): error C2872: 'byte': ambiguous symbol
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(202,23): message : could be 'unsigned char byte'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstddef(29,24): message : or       'std::byte'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\wtypes.h(106,26): error C2872: 'byte': ambiguous symbol
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(202,23): message : could be 'unsigned char byte'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstddef(29,24): message : or       'std::byte'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\wtypes.h(112,26): error C2872: 'byte': ambiguous symbol
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(202,23): message : could be 'unsigned char byte'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstddef(29,24): message : or       'std::byte'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\wtypes.h(118,26): error C2872: 'byte': ambiguous symbol
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(202,23): message : could be 'unsigned char byte'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstddef(29,24): message : or       'std::byte'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\wtypes.h(493,26): error C2872: 'byte': ambiguous symbol
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(202,23): message : could be 'unsigned char byte'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstddef(29,24): message : or       'std::byte'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\objidlbase.h(2275,79): error C2872: 'byte': ambiguous symbol
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(202,23): message : could be 'unsigned char byte'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstddef(29,24): message : or       'std::byte'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\objidlbase.h(2289,62): error C2872: 'byte': ambiguous symbol
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(202,23): message : could be 'unsigned char byte'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstddef(29,24): message : or       'std::byte'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\objidlbase.h(8492,79): error C2872: 'byte': ambiguous symbol
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(202,23): message : could be 'unsigned char byte'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstddef(29,24): message : or       'std::byte'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\objidlbase.h(8508,62): error C2872: 'byte': ambiguous symbol
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(202,23): message : could be 'unsigned char byte'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstddef(29,24): message : or       'std::byte'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\objidl.h(10444,69): error C2872: 'byte': ambiguous symbol
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(202,23): message : could be 'unsigned char byte'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstddef(29,24): message : or       'std::byte'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\objidl.h(11002,77): error C2872: 'byte': ambiguous symbol
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(202,23): message : could be 'unsigned char byte'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstddef(29,24): message : or       'std::byte'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\objidl.h(11034,77): error C2872: 'byte': ambiguous symbol
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(202,23): message : could be 'unsigned char byte'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstddef(29,24): message : or       'std::byte'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\objidl.h(11542,79): error C2872: 'byte': ambiguous symbol
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(202,23): message : could be 'unsigned char byte'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstddef(29,24): message : or       'std::byte'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\objidl.h(11557,62): error C2872: 'byte': ambiguous symbol
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(202,23): message : could be 'unsigned char byte'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstddef(29,24): message : or       'std::byte'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\objidl.h(12018,26): error C2872: 'byte': ambiguous symbol
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(202,23): message : could be 'unsigned char byte'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstddef(29,24): message : or       'std::byte'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\objidl.h(13832,62): error C2872: 'byte': ambiguous symbol
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(202,23): message : could be 'unsigned char byte'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstddef(29,24): message : or       'std::byte'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\objidl.h(13847,62): error C2872: 'byte': ambiguous symbol
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(202,23): message : could be 'unsigned char byte'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstddef(29,24): message : or       'std::byte'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\objidl.h(15586,79): error C2872: 'byte': ambiguous symbol
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(202,23): message : could be 'unsigned char byte'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstddef(29,24): message : or       'std::byte'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\objidl.h(15602,62): error C2872: 'byte': ambiguous symbol
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(202,23): message : could be 'unsigned char byte'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstddef(29,24): message : or       'std::byte'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\objidl.h(15749,77): error C2872: 'byte': ambiguous symbol
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(202,23): message : could be 'unsigned char byte'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstddef(29,24): message : or       'std::byte'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\objidl.h(15788,77): error C2872: 'byte': ambiguous symbol
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(202,23): message : could be 'unsigned char byte'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstddef(29,24): message : or       'std::byte'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\objidl.h(15805,79): error C2872: 'byte': ambiguous symbol
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(202,23): message : could be 'unsigned char byte'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstddef(29,24): message : or       'std::byte'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\objidl.h(15822,62): error C2872: 'byte': ambiguous symbol
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(202,23): message : could be 'unsigned char byte'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstddef(29,24): message : or       'std::byte'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\objidl.h(16067,62): error C2872: 'byte': ambiguous symbol
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(202,23): message : could be 'unsigned char byte'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstddef(29,24): message : or       'std::byte'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\objidl.h(16086,62): error C2872: 'byte': ambiguous symbol
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\rpcndr.h(202,23): message : could be 'unsigned char byte'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstddef(29,24): message : or       'std::byte'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\oaidl.h(571,26): error C2872: 'byte': ambiguous symbol


What I have tried:

I have been trying to solve the problem since yesterday. I don't think google can help with this problem.
Posted
Updated 18-Dec-23 5:01am
v4
Comments
Richard MacCutchan 18-Dec-23 11:55am    
So exactly which headers do you have in your source file?

I have found the gdiplus.h header file to be a bit problematic. I almost always use it in a precompiled header file and it usually looks like this :
C++
#define NOMINMAX  // this removes the min and max definitions

#include <SDKDDKVer.h>

// various windows and C RTL headers go here

#define _USE_MATH_DEFINES	// get PI, e, etc. definitions
#include <math.h>

#pragma warning( push )
#pragma warning( disable : 4458 )
#include <gdiplus.h>
#pragma warning( pop )

#include <vector>
#include <string>
#include <algorithm>

// other STL headers here
With my code I always use warning level 4 and the pragma turns off warning 4458 which usually results from the GDI+ headers. I include gdiplus.h before the STL headers and after the windows and RTL headers.

One other thing : I never, ever put a using namespace statement in a header file. They can not be undone and usually cause problems.
 
Share this answer
 
Comments
Gbenbam 27-Dec-23 8:04am    
How does one create a pre-compiled header with visual studio 2022?
Gbenbam 27-Dec-23 8:08am    
Can you additionally tell me how to use warning level 4 and the pragma turns off warning 445 that usually results from the GDI+ headers?
Gbenbam 27-Dec-23 8:47am    
Sorry, but your sample pre-compiled header files does not specify where to put C++ runtime libraries. My project needs gdiplusheaders.h, where do you suppose that I put that. Finally, do you by chance know what namespace graphics and image GDI+ classes belong to? My experience is that one or the other needs gdiplus.h while the other needs gdiplusheaders.h.
It looks like you have

C++
using namespace std;


somewhere before inclusions
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900