ما هو الترتيب الصحيح لترتيب ملفات الرأس التالية في تطبيق C++؟

[ad_1]

خرج تطبيقي بأخطاء التجميع التالية. تظهر الأخطاء أن المشكلة تكمن في ترتيب ملفات الرأس الخاصة بي. من فضلك، ما هي الطريقة الصحيحة لترتيب ملفات الرأس في تطبيقي مع الأخذ في الاعتبار رسائل الخطأ التالية. يرجى ملاحظة أنني لم أقم بتضمين أي من ملفات الرأس المعروضة في طلبي. يجب أن يتم تضمينه في واحد أو أكثر من ملفات الرأس الرئيسية التي أدرجتها في طلبي. أعتقد أن الرؤوس المتضاربة هي التالية الموجودة في winmain:

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

و

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

الموجود في ملف آخر

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

ما حاولت:

أحاول حل المشكلة منذ الأمس. لا أعتقد أن جوجل يمكنها المساعدة في حل هذه المشكلة.

الحل 1

لقد وجدت أن ملف الرأس gdiplus.h يمثل مشكلة بعض الشيء. أستخدمه دائمًا تقريبًا في ملف رأس مُجمَّع مسبقًا وعادةً ما يبدو كما يلي:

سي ++
#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

باستخدام الكود الخاص بي، أستخدم دائمًا مستوى التحذير 4 ويقوم البراجما بإيقاف تشغيل التحذير 4458 والذي ينتج عادةً عن رؤوس GDI+. أقوم بتضمين gdiplus.h قبل رؤوس STL وبعد النوافذ ورؤوس RTL.

شيء آخر: لم أضع أبدًا using namespace البيان في ملف الرأس. لا يمكن التراجع عنها وعادة ما تسبب مشاكل.

[ad_2]

コメント

タイトルとURLをコピーしました