Error: multiple types in one declaration
I'm using a UART connection to read GPS data. I have a structure for the position data and other parameters but here is the annoyance. In my first setup I was using a christmas present (Arduino 2560) but now I'm using a Pro Mini (ATmega 328). The code is the same but it throws up this error and points me to the struct or rather the semi-colon of the struct. The struct contains uint8_t and int32_t but both are int so should not cause problems and I have tried having just uint8_t or int32_t and I still get the same error.
I have googled for answers from any programming site and struck out with the answers given so far (semi colon, previous definitions, library definitions etc) but I just cannot shift these errors. The stated line is the longitude value and it is handled the same as the other values so I am unsure why anything weird may come from the handling side but in the interest of full disclosure the handling parts are included too.
Error message
E:\Arduino\arduino-0022\hardware\tools\avr\bin\avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=22 -IE:\Arduino\arduino-0022\hardware\arduino\cores\arduino -IE:\Arduino\arduino-0022\libraries\Wire -IE:\Arduino\Sketchbook\ArduDriver\testbed\libraries\RC
In file included from C:\Users_\AppData\Local\Temp\build2983500146223259179.tmp\ArduDriver.cpp:21:
C:\Users_\AppData\Local\Temp\build2983500146223259179.tmp/defines.h:30: error: multiple types in one declaration
defines.h
//********Definitions********//
#define SDA 4 // not needed but it reminds you not to use them
#define SCL 5 // not needed but it reminds you not to use them
#define BUF_LEN 60 // Length for GPS buffer
#define ToRad (0.01745329252) // *pi/180
#define ToDeg (57.2957795131) // *180/pi
//******Analogue inputs******//
#define SONAR 0
//********PWM outputs********//
// #define blah 3
// #define blip 5
// #define blop 6
#define ESC 9
#define SERVO 10
// #define argh 11
struct Location {
uint8_t id; // id parameter
uint8_t options; // option parameter
uint8_t stg; // stage parameter
int32_t alt; // altitude parameter
int32_t lat; // latitude parameter
int32_t lng; // longitude parameter
};
struct Location home = {0,0,0,0,0,0}; // home location
struct Location prev_WP = {0,0,0,0,0,0}; // last waypoint
struct Location cur_loc = {0,0,0,0,0,0}; // current location
struct Location next_WP = {0,0,0,0,0,0};
struct XYZ {
uint16_t x;
uint16_t y;
uint16_t z;
};
struct XYZ mag = {0,0,0};
struct XYZ gyro = {0,0,0};
struct XYZ accel = {0,0,0};
struct readings {
uint16_t raw;
uint16_t avg;
};
struct readings sonar = {0,0};
GPS Handling
cur_loc.lat = join_4_bytes(&MTK_buffer[0])*10;
cur_loc.lng = join_4_bytes(&MTK_buffer[4])*10;
cur_loc.alt = join_4_bytes(&MTK_buffer[8]); //alt_MSL M*100
ground_speed = join_4_bytes(&MTK_buffer[12]); //M*100
ground_course = join_4_bytes(&MTK_buffer[16]) / 10000; // Heading 2D
NumSats = MTK_buffer[20];
GPS_fix = MTK_buffer[21];
iTOW = join_4_bytes(&MTK_buffer[22]);
join_4_bytes
int32_t join_4_bytes(byte Buffer[])
{
longUnion.byte[3] = *Buffer;
longUnion.byte[2] = *(Buffer+1);
longUnion.byte[1] = *(Buffer+2);
longUnion.byte[0] = *(Buffer+3);
return(longUnion.dword);
}