如2021.10.24编译地图匹配出现:
../include/Position_V2I.h:2:8: error: redefinition of ‘struct Position_V2I’
struct Position_V2I
^~~~~~~~~~~~
In file included from ../include/MapData_V2I.h:4:0,
from FacilityAPI_hjc_copy.cpp:3:
../include/Position_V2I.h:2:8: note: previous definition of ‘struct Position_V2I’
struct Position_V2I
问题描述:
在Position_V2I.h中定义了一个结构体:‘struct Position_V2I’
在MapData_V2I.h和BsmData_V2I.h中应用,编译时会出现上述重定义的问题。
解决方法:
在Position_V2I.h中定义结构体是加入语句:
#ifndef _Position_V2I_h
#define _Position_V2I_h
..........
#endif
比如:
#ifndef _Position_V2I_h
#define _Position_V2I_h
typedef struct Position_V2I
{
double lat;
double lon;
double elev;
}Position_V2I;
#endif