Как получилось, что заголовочный файл windows, включая мой, а затем вызывает сообщение об ошибке?
Ниже приведен фрагмент моей программы, скомпилированной с использованием VC++ 2015:
#define TARGET_SIMU #include <iostream> #define INT32_ALREADY_DEFINED #define _CRT_RAND_S #include <process.h> #include <search.h> #include "pcap.h" #include "remote-ext.h" #include "iptcom.h" /* Common type definitions for IPT */ #include "iptcom_priv.h" #include "iphlpapi.h"
Я получил сообщение, как показано ниже (я удалил некоторые из них, которые не важны для обсуждения). См. первую ошибку. Заголовочный файл VC++
C:\Program Files (x86)\Windows Kits\8.1\Include\shared\netioapi.h
включает в себя мой заголовочный файл
D:\programs\TCL\DBU-collector\IPTCom-sample-codes\windows-libs\libs\win32\winpcap\ntddndis.h
Как же так? Нет никакой причины, по которой заголовочный файл Microsoft включает в себя мой.
Ошибка от
netioapi.h, который тоже является заголовком Microsoft.
Что я могу сделать для такой ошибки?
1>------ Build started: Project: dsim, Configuration: Debug Win32 ------ 1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(368,5): warning MSB8004: Output Directory does not end with a trailing slash. This build instance will add the slash as it is required to allow proper evaluation of the Output Directory. 1> dsim.cpp 1> Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\iostream 1> Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\istream ............................................. 1> Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\limits.h 1> Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\vcruntime.h 1> Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\cmath ............................................. 1> Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\xlocale 1> Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\cstring ............................................. 1> Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\stdint.h 1> Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\vcruntime.h 1> Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\limits ............................................. 1> Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\utility 1> Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\iosfwd 1> Note: including file: C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\crtdbg.h 1> Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\vcruntime_new_debug.h ............................................. 1> Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\xlocinfo.h 1> Note: including file: C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\ctype.h ............................................. 1> Note: including file: C:\Program Files (x86)\Windows Kits\8.1\Include\shared\ktmtypes.h 1> Note: including file: C:\Program Files (x86)\Windows Kits\8.1\Include\um\fileapi.h ............................................. 1> Note: including file: C:\Program Files (x86)\Windows Kits\8.1\Include\um\securitybaseapi.h 1> Note: including file: C:\Program Files (x86)\Windows Kits\8.1\Include\um\namespaceapi.h ............................................. 1> Note: including file: C:\Program Files (x86)\Windows Kits\8.1\Include\shared\poppack.h 1> Note: including file: C:\Program Files (x86)\Windows Kits\8.1\Include\um\winuser.h ............................................. 1> Note: including file: C:\Program Files (x86)\Windows Kits\8.1\Include\shared\pshpack8.h 1> Note: including file: C:\Program Files (x86)\Windows Kits\8.1\Include\shared\poppack.h 1> Note: including file: C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h ............................................. 1> Note: including file: C:\Program Files (x86)\Windows Kits\8.1\Include\um\propidl.h 1> Note: including file: C:\Program Files (x86)\Windows Kits\8.1\Include\shared\poppack.h 1> Note: including file: C:\Program Files (x86)\Windows Kits\8.1\Include\um\oleauto.h 1> Note: including file: C:\Program Files (x86)\Windows Kits\8.1\Include\shared\pshpack8.h ............................................. 1> Note: including file: C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\time.h 1> Note: including file: C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\io.h 1> Note: including file: C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\corecrt_io.h 1> Note: including file: d:\programs\tcl\dbu-collector\iptcom-sample-codes\windows-libs\libs\win32\winpcap\IP6_misc.h 1> Note: including file: C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h 1> Note: including file: C:\Program Files (x86)\Windows Kits\8.1\Include\shared\ws2ipdef.h 1> Note: including file: C:\Program Files (x86)\Windows Kits\8.1\Include\shared\in6addr.h 1> Note: including file: D:\programs\TCL\DBU-collector\IPTCom-sample-codes\windows-libs\libs\win32\winpcap\pcap-bpf.h 1> Note: including file: D:\programs\TCL\DBU-collector\IPTCom-sample-codes\windows-libs\libs\win32\winpcap\remote-ext.h 1> Note: including file: D:\programs\TCL\DBU-collector\IPTCom\iptcom-api\api\iptcom.h 1> Note: including file: d:\programs\tcl\dbu-collector\iptcom\iptcom-api\api\ipt.h 1> Note: including file: D:\programs\TCL\DBU-collector\IPTCom\export-tdc\api\iptDef.h 1> Note: including file: d:\programs\tcl\dbu-collector\iptcom\iptcom-api\api\mdcom.h 1> Note: including file: d:\programs\tcl\dbu-collector\iptcom\iptcom-api\api\pdcom.h 1> Note: including file: d:\programs\tcl\dbu-collector\iptcom\iptcom-api\api\iptcom.h 1> Note: including file: D:\programs\TCL\DBU-collector\IPTCom\iptcom-source\src\prv\iptcom_priv.h 1> Note: including file: D:\programs\TCL\DBU-collector\IPTCom\export-tdc\api\tdcSyl.h 1> Note: including file: d:\programs\tcl\dbu-collector\iptcom\export-tdc\api\iptDef.h 1> Note: including file: D:\programs\TCL\DBU-collector\IPTCom\export-tdc\api\tdcApi.h 1> Note: including file: d:\programs\tcl\dbu-collector\iptcom\export-tdc\api\tdcSyl.h 1> Note: including file: D:\programs\TCL\DBU-collector\IPTCom\iptcom-api\api\vos.h 1> Note: including file: d:\programs\tcl\dbu-collector\iptcom\iptcom-source\src\prv\vos_priv.h 1> Note: including file: d:\programs\tcl\dbu-collector\iptcom\iptcom-source\src\prv\mdcom_priv.h 1> Note: including file: d:\programs\tcl\dbu-collector\iptcom\iptcom-source\src\prv\netdriver.h 1> Note: including file: d:\programs\tcl\dbu-collector\iptcom\iptcom-source\src\prv\pdcom_priv.h 1> Note: including file: C:\Program Files (x86)\Windows Kits\8.1\Include\um\iphlpapi.h 1> Note: including file: C:\Program Files (x86)\Windows Kits\8.1\Include\shared\iprtrmib.h 1> Note: including file: C:\Program Files (x86)\Windows Kits\8.1\Include\shared\mprapidef.h 1> Note: including file: C:\Program Files (x86)\Windows Kits\8.1\Include\shared\lmcons.h 1> Note: including file: C:\Program Files (x86)\Windows Kits\8.1\Include\shared\ipifcons.h 1> Note: including file: C:\Program Files (x86)\Windows Kits\8.1\Include\shared\ipmib.h 1> Note: including file: C:\Program Files (x86)\Windows Kits\8.1\Include\shared\ifmib.h 1> Note: including file: C:\Program Files (x86)\Windows Kits\8.1\Include\shared\ifdef.h 1> Note: including file: C:\Program Files (x86)\Windows Kits\8.1\Include\shared\nldef.h 1> Note: including file: C:\Program Files (x86)\Windows Kits\8.1\Include\shared\tcpmib.h 1> Note: including file: C:\Program Files (x86)\Windows Kits\8.1\Include\shared\udpmib.h 1> Note: including file: C:\Program Files (x86)\Windows Kits\8.1\Include\um\ipexport.h 1> Note: including file: C:\Program Files (x86)\Windows Kits\8.1\Include\shared\packon.h 1> Note: including file: C:\Program Files (x86)\Windows Kits\8.1\Include\shared\packoff.h 1> Note: including file: C:\Program Files (x86)\Windows Kits\8.1\Include\um\iptypes.h 1> Note: including file: C:\Program Files (x86)\Windows Kits\8.1\Include\shared\tcpestats.h 1> Note: including file: C:\Program Files (x86)\Windows Kits\8.1\Include\shared\netioapi.h 1> Note: including file: D:\programs\TCL\DBU-collector\IPTCom-sample-codes\windows-libs\libs\win32\winpcap\ntddndis.h 1>c:\program files (x86)\windows kits\8.1\include\shared\netioapi.h(163): error C3646: 'PhysicalMediumType': unknown override specifier 1>c:\program files (x86)\windows kits\8.1\include\shared\netioapi.h(163): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>d:\programs\tcl\dbu-collector\dsim\dsim.cpp(115): error C2065: 'ETH_CARD': undeclared identifier 1>d:\programs\tcl\dbu-collector\dsim\dsim.cpp(115): error C2065: 'pCard': undeclared identifier 1>d:\programs\tcl\dbu-collector\dsim\dsim.cpp(121): error C2065: 'pCard': undeclared identifier 1>d:\programs\tcl\dbu-collector\dsim\dsim.cpp(121): error C3861: 'GetCardRef': identifier not found 1>d:\programs\tcl\dbu-collector\dsim\dsim.cpp(124): error C2065: 'pCard': undeclared identifier 1>d:\programs\tcl\dbu-collector\dsim\dsim.cpp(143): error C2065: 'pCard': undeclared identifier 1>d:\programs\tcl\dbu-collector\dsim\dsim.cpp(143): error C3861: 'AddSimulatedInterface': identifier not found 1>d:\programs\tcl\dbu-collector\dsim\dsim.cpp(129): error C4996: 'sscanf': This function or variable may be unsafe. Consider using sscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. 1> c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\stdio.h(2254): note: see declaration of 'sscanf' ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Что я уже пробовал:
Я опубликовал эту проблему на форуме MSDN, но ответа не получил. Этого включения я тоже не ожидаю.