duplicate 'unsigned'是什么意思?
碰到一个问题
在我引用的某个库的头文件里 sybdb.h ,有这样的定义
typedef unsigned long DWORD
我自己定义的头文件里 comdef.h,有这样的定义
#ifndef DWORD
#define DWORD unsigned long
#endif
在我的一个CPP里,这样包含头文件
#include <sybdb.h>
#include "comdef.h"
编译器提示:
duplicate 'unsigned'
我只能反过来包含
#include "comdef.h"
#include <sybdb.h>
这样就好麻烦,总是要把#include <sybdb.h> 放在最前面,我不知道怎么解决这个问题。
在我引用的某个库的头文件里 sybdb.h ,有这样的定义
typedef unsigned long DWORD
我自己定义的头文件里 comdef.h,有这样的定义
#ifndef DWORD
#define DWORD unsigned long
#endif
在我的一个CPP里,这样包含头文件
#include <sybdb.h>
#include "comdef.h"
编译器提示:
duplicate 'unsigned'
我只能反过来包含
#include "comdef.h"
#include <sybdb.h>
这样就好麻烦,总是要把#include <sybdb.h> 放在最前面,我不知道怎么解决这个问题。
作者: sgch2010 发布时间: 2011-06-02
编译时加 -DDWORD
作者: justkk 发布时间: 2011-06-02
个人感觉你这个定义不是很好 还容易引起混乱
#ifndef DWORD
#define DWORD unsigned long
#endif
你还是更换一下你个人的思维吧
#ifndef DWORD
#define DWORD unsigned long
#endif
你还是更换一下你个人的思维吧
作者: haohai91 发布时间: 2011-06-02