Expected primary-expression before '.'

Hi all,
I'am working with this libray here but I have an error when I try to comile with Arduino and I don't know why.
For these lines, I got expected primary-expression before '.' token for each attribut.

FusionVector3 gyroscopeSensitivity = {
   .axis.x = 1.0f,
   .axis.y = 1.0f,
   .axis.z = 1.0f,

So I've searched the declarion for FusionVector3, I found this

typedef union {
   float array[3];

   struct {
       float x;
       float y;
       float z;
   } axis;
} FusionVector3;

I've tried to remove dot before axis but this isn't the solution, I've never work with union with struct inside....

FusionVector3 gyroscopeSensitivity = {

Your library is a C library, rather than an Arduino Library (which is C++.)
C has a feature called "designated initializers" that C++ doesn't have:


MissDrew's suggested fix should work fine, especially since all three initial values are the same.

Ok thanks for you answer. So when you say

The fix should only work if all values are the same ?

If they're not the same, you would have to make sure that the x, y, and z values were specified in the correct order (the same order that they're defined in the struct.)

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.