vc使用jsoncpp头文件冲突问题
来源:互联网 发布:react router 数据 编辑:程序博客网 时间:2024/04/29 14:07
编译时出现
1>d:\program files (x86)\microsoft visual studio 9.0\vc\include\xdebug(32) : warning C4229: 使用了记时错误 : 忽略数据上的修饰符1>d:\program files (x86)\microsoft visual studio 9.0\vc\include\xdebug(32) : error C2365: “operator new”: 重定义;以前的定义是“函数”1>d:\program files (x86)\microsoft visual studio 9.0\vc\include\xdebug(32) : error C2078: 初始值设定项太多1>d:\program files (x86)\microsoft visual studio 9.0\vc\include\xdebug(32) : error C2440: “初始化”: 无法从“int”转换为“void *”1>d:\program files (x86)\microsoft visual studio 9.0\vc\include\xlocale(343) : error C2227: “->_Name”的左边必须指向类/结构/联合/泛型类型1>d:\program files (x86)\microsoft visual studio 9.0\vc\include\xlocale(343) : error C2228: “.c_str”的左边必须有类/结构/联合1>d:\program files (x86)\microsoft visual studio 9.0\vc\include\xlocale(344) : error C2065: “_Cat”: 未声明的标识符1>d:\program files (x86)\microsoft visual studio 9.0\vc\include\xlocale(344) : error C2065: “_Other”: 未声明的标识符1>d:\program files (x86)\microsoft visual studio 9.0\vc\include\xlocale(344) : error C2228: “._Ptr”的左边必须有类/结构/联合1>d:\program files (x86)\microsoft visual studio 9.0\vc\include\xlocale(344) : fatal error C1003: 错误计数超过 100;正在停止编译
jsoncpp的代码拿着好久了,一直不能加入到自己库,总出现这些错误,一直没搞明白怎么回事
今天无意中发现是debug版本中是new在作怪
#ifdef _DEBUG#define new DEBUG_NEW#endif
搞的好纠结的,印象中试过几次 都没找着问题,哎..
解决方式如下:修改json.h
#ifndef JSON_JSON_H_INCLUDED# define JSON_JSON_H_INCLUDED#ifdef new#define REDEFINE_NEW#undef new#endif // new//# include "autolink.h"# include "value.h"# include "reader.h"# include "writer.h"# include "features.h"#ifdef REDEFINE_NEW#define new DEBUG_NEW#endif // REDEFINE_NEW#endif // JSON_JSON_H_INCLUDED
先取消new的DEBUG_NEW宏定义,尾巴上再重新定义宏,完美解决呀..
得养成好习惯,头文件中不能写的代码不能写... 我是有个模板类的头文件中使用了DEBUG_NEW宏,没法
0 0
- vc使用jsoncpp头文件冲突问题
- 头文件冲突问题
- 头文件包含冲突问题
- VC下Winsock头文件冲突解决方法
- 头文件与命名冲突问题
- VC/MFC 使用jsoncpp步骤及注意的问题
- Jsoncpp使用中的问题
- 使用jsoncpp的问题
- VC++预编译头文件问题
- VC++中的头文件包含问题
- VC++中的头文件包含问题
- VC++中自定义头文件的使用
- LwIP和FreeRTOS的头文件冲突问题
- C++使用jsoncpp库问题
- VC下jsoncpp的使用入门(转)
- 使用JsonCPP解析JSON数据(VC++)
- VC下jsoncpp的使用入门(转)
- VC下使用JSONCPP(json)
- PB实现TreeView多级分类检索(案例)
- 作业 进程 和 线程【转】
- struts1学习笔记(1.5)
- SQLite
- Android 图片相关注意事项
- vc使用jsoncpp头文件冲突问题
- Android中对话框(Dialog)的创建方法
- 算法训练 删除多余括号
- ImageLoader图片处理
- 汇编语言:三个数比较大小,输出最小的那个数。
- Java:String、StringBuffer和StringBuilder区别
- poj1511小灶第三次作业(dijstra)
- Android自定义控件系列案例【三】
- LRU 和 FIFO 页面置换算法