accessing struct data members

hey guys I'm having a bit of difficulty was hoping you might be able to help me correct the problem with the sketch.
Thanks
Zack

#include <RFduinoBLE.h>
#include <math.h>
#include "Adafruit_Sensor.h"
#include "Adafruit_LSM9DS0.h"
#include "stdio.h"
#include "String.h"


/* 
 * http://forum.rfduino.com/index.php?topic=289.0
 * The maximum packet size is 20 bytes, and you can send a maximum 
 * of up to 6 packets per interval. For a total of 120 bytes per connection interval.
*/

/*
 * [x,y,z] Accel (3)  Byte
 * [x,y,z] Gyro  (3)  Byte
 * [x,y,z] Mag   (3)  Byte
 * [TimeStamp]   (1)  Byte
 * 10 Bytes Total....  
 * 
 */


typedef struct box_imu_t{
     struct accel{
            byte x;
            byte y;
            byte z;
        };
     struct gyro{
            byte x;
            byte y;
            byte z;
        };
     struct mag{
            byte x;
            byte y;
            byte z;
        };
        /*TimeStamp */
    byte timestamp; //8 Bits
    
  } box_imu_t;




/* Global Varibles Initilization */


Adafruit_LSM9DS0 lsm = Adafruit_LSM9DS0(1000);
int BLEState = 0;


void setupSensor(){
  /* 1.) Set the accelerometer range */
  
  //lsm.setupAccel(lsm.LSM9DS0_ACCELRANGE_2G);
  //lsm.setupAccel(lsm.LSM9DS0_ACCELRANGE_4G);
  //lsm.setupAccel(lsm.LSM9DS0_ACCELRANGE_6G);
  //lsm.setupAccel(lsm.LSM9DS0_ACCELRANGE_8G);
  lsm.setupAccel(lsm.LSM9DS0_ACCELRANGE_16G);
  
  /* 2.) Set the magnetometer sensitivity */
  
  //lsm.setupMag(lsm.LSM9DS0_MAGGAIN_2GAUSS);
  //lsm.setupMag(lsm.LSM9DS0_MAGGAIN_4GAUSS);
  //lsm.setupMag(lsm.LSM9DS0_MAGGAIN_8GAUSS);
  lsm.setupMag(lsm.LSM9DS0_MAGGAIN_12GAUSS);

  /* 3.) Setup the gyroscope */
  
  //lsm.setupGyro(lsm.LSM9DS0_GYROSCALE_245DPS);
  //lsm.setupGyro(lsm.LSM9DS0_GYROSCALE_500DPS);
  lsm.setupGyro(lsm.LSM9DS0_GYROSCALE_2000DPS);
}

void setup() {


#ifdef DEBUG
#endif


   // this is the data we want to appear in the advertisement
  
   RFduinoBLE.advertisementData = "IMU";
   
   // start the BLE stack
  
   RFduinoBLE.begin();


    if (!lsm.begin());

#ifdef DEBUG
#endif

}

void loop() {
  
  // put your main code here, to run repeatedly:
  lsm.read();
 // code here
 
#ifdef DEBUG
 // code here
#endif  


// saving to data structor


box_imu_t packit;

packit.accel.x = {lsm.accelData.x;
                  lsm.accelData.y;
                  lsm.accelData.z;
                 };
                          
packit.gyro  = {lsm.gyroData.x;
                lsm.gyroData.y;
                lsm.gyroData.z;
               };
                          
packit.mag   = {lsm.magData.x;
                          lsm.magData.y;
                          lsm.magData.z;
                          };

packit.timestamp = 0;



if(BLEState == 1){
  
#ifdef XYZ

#else
RFduinoBLE.send(packit, 10);
#endif 

  }
}

void RFduinoBLE_onConnect(){
  
BLEState = 1;

#ifdef DEBUG
//Serial.println("Connect");
#endif
}


void RFduinoBLE_onDisconnect(){
#ifdef DEBUG
//Serial.println("Disconnect"); 
#endif

BLEState = 0;

}


void RFduinoBLE_onReceive(char *data, int len) {
 (void)data;
 (void)len;
}

I don't think this sketch has a "the" problem. Go do a C++ tutorial: there are a heap of them on the 'net.

Take the structs accel, gyro and mag out of the box_imu struct and place them before the box_imu struct. Now you can add variables of type accel_t, gyro_t and mag_t to the box_imu struct.

Thanks guys that seemed to be the solution, for some reason it didn't like the nested sturct. Got that portion running now so I'm guessing there will be further questions at a later point.
Thanks Again
ZBay

ZBay:
Thanks guys that seemed to be the solution, for some reason it didn't like the nested sturct. Got that portion running now so I'm guessing there will be further questions at a later point.
Thanks Again
ZBay

Well, if this sketch compiles then I don't know as much about C as I thought I did, because this syntax:

packit.accel.x = {lsm.accelData.x;
                  lsm.accelData.y;
                  lsm.accelData.z;
                 };

I don't know how it gets parsed. Is this treated as a lambda or something?