我需要在visual studio中解析c代码中的json文件。但是当我包含json-c头时,我得到了错误。我该如何解决这些问题呢?
#include<ntddk.h>
#include<wdf.h>
#include<fwpmk.h>
#include<fwpsk.h>
#define INITGUID
#include<guiddef.h>
#include<fwpmu.h>
#undef _CRT_STRINGIZE
#undef _CRT_WIDE
#undef __CRTDECL
#include<json-c/json.h>
#include<json-c/json_object.h>
The errors are:
Severity Code Description Project File Line Suppression State
Warning C6067 _Param_(2) in call to 'DbgPrint' must be the address of a string. Actual type: 'void *'. WfpcalloutDriver3 C:\Users\hp\Desktop\VK\WfpcalloutDriver3\Source.c 88
Warning C4083 expected ')'; found identifier '_VCRUNTIME_DISABLED_WARNINGS' WfpcalloutDriver3 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\stdint.h 16
Error C2220 the following warning is treated as an error WfpcalloutDriver3 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\vcruntime.h 61
Warning C4083 expected ')'; found identifier '_VCRUNTIME_DISABLED_WARNINGS' WfpcalloutDriver3 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\vcruntime.h 61
Warning C4005 '_CRT_STRINGIZE': macro redefinition WfpcalloutDriver3 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\vcruntime.h 111
Warning C4005 '_CRT_WIDE': macro redefinition WfpcalloutDriver3 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\vcruntime.h 114
Warning C4005 '__CRTDECL': macro redefinition WfpcalloutDriver3 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\vcruntime.h 155
1条答案
按热度按时间d5vmydt91#
刚刚看了一下github页面,上面写着(强调我的):
要使用json-c,您可以包含json. h、或最好包含,后者是以下更具体的头文件之一:
所以,看起来你包含了json. h * 和 * json_object. h。这就解释了宏的重定义。试着去掉
#include<json-c/json.h>
。