Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 8 Replies) warning: type 'struct MPU6050' violates one definition rule [-Wodr] (Read 4983 times)
FrankP
Full Member
***
Offline


Posts: 240
Joined: Oct 19th, 2011
warning: type 'struct MPU6050' violates one definition rule [-Wodr]
Jan 26th, 2019 at 3:21pm
Print Post  
I've been trying to track down the cause of the "warning: type 'struct MPU6050' violates one definition rule [-Wodr]" that has been cropping up in my previously problem-free Arduino projects.  I found a post on the Arduino forum that suggested that the problem was caused by an Arduino IDE update from AVR board manager V1.6.21 to .22 & .23.  I was able to suppress/remove the errant warning by downgrading from 1.6.23 to 1.6.21 in the Arduino IDE itself.

However, I can't seem to get rid of these warnings when I compile the same project in VS2017CE/Visual Micro.  I suspect this is because the VS/VM environment is still using AVR v1.6.23, but if I look in Visual Micro Explorer an click on 'Arduino AVR Boards', it says "Arduino AVR Boards by Arduino Version 1.6.21 INSTALLED built-in version 1.6.23 is installed download", indicating that VS/VM is also using the correct AVR board version.

I have attached the .INO file for a project that experiences the problem (and compiles cleanly in the Arduino IDE with V1.6.21), and text files containing the verbose output from the VS/VM run and the Arduino IDE run.  Note:  I had to attach the Arduino verbose compiler output file to a second post, as it seems I can't attach more than two files Sad.

I'm sure this is something simple, but apparently not simple enough for me! Wink.

TIA,

Frank
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
FrankP
Full Member
***
Offline


Posts: 240
Joined: Oct 19th, 2011
Re: warning: type 'struct MPU6050' violates one definition rule [-Wodr]
Reply #1 - Jan 26th, 2019 at 3:22pm
Print Post  
Here's the verbose output from the 'clean' compile using the Arduino IDE

  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
FrankP
Full Member
***
Offline


Posts: 240
Joined: Oct 19th, 2011
Re: warning: type 'struct MPU6050' violates one definition rule [-Wodr]
Reply #2 - Jan 26th, 2019 at 8:04pm
Print Post  
I see now that the Board Manager list shows both 1.6.21 and 1.6.23 version of the AVR board manager is installed.  This  (I think) may be what is causing the 'one rule' violation warning, as it seems VM is still using the 1.6.23 manager instead of the 1.6.21 one.

I tried uninstalling the 1.6.23 version but VM won't let me.  It complains that 'this is a built-in platform. Built-in platforms cannot be removed...."

If I left-click on the (also installed) 1.6.21 platform, VM asks me if I would like to remove it.  Apparently you can remove older versions, but not the latest one, even if the latest one isn't the one you want

Any ideas?

TIA,

Frank
  
Back to top
 
IP Logged
 
FrankP
Full Member
***
Offline


Posts: 240
Joined: Oct 19th, 2011
Re: warning: type 'struct MPU6050' violates one definition rule [-Wodr]
Reply #3 - Jan 28th, 2019 at 2:06am
Print Post  
I have narrowed the problem down to the point where all extraneous code has been removed, leaving only the following:

Code
Select All
/*
    Name:       FourWD_WallE_V5.ino
    Created: 1/27/2019 12:14:57 PM
    Author:     FRANKWIN10\Frank
*/
#include <EEPROM.h>
#include <Wire.h>
#include "MPU6050_6Axis_MotionApps20.h" //06/23/18 modified for 20Hz interrupt freq
#include "I2Cdev.h"


void setup()
{


}

void loop()
{


}
 



The above program will produce the 'one definition' warning in VS2017/VM, but compiles cleanly in the Arduino IDE 1.8.7 using either 1.6.21 or 1.6.23 board manager versions (at one time I thought this was the problem, but apparently not).

I see in the verbose output that including i2cdev.h also causes all the stuff in the RTIMULib-Arduino-master library to be included and compiled, and so I suspect this is where the 'one definition' warning is coming from.  However, this warning does not occur when compiled in the IDE, even though I would have sworn that both VS/VM and the IDE use the same exact compiler tools (I thought all VM did was ship the source file off to the Arduino IDE).

In any case, I have attached a zip file containing my entire project folder in case there is some issue with the actual source files included with the project.  The folder contains two text files containing the verbose compiler outputs from both the VS/VM environment and the Arduino IDE.

TIA,

Frank
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: warning: type 'struct MPU6050' violates one definition rule [-Wodr]
Reply #4 - Jan 29th, 2019 at 3:31pm
Print Post  
I will look when I get time. You will confuse things by installing avr via board manager. avr is supplied with the arduino ide so when you update arduino you update avr

I suggest you delete the "c:\users\name\appdata\local\arduino15\packages\arduino" folder then restart the ide.

  
Back to top
WWW  
IP Logged
 
FrankP
Full Member
***
Offline


Posts: 240
Joined: Oct 19th, 2011
Re: warning: type 'struct MPU6050' violates one definition rule [-Wodr]
Reply #5 - Jan 29th, 2019 at 3:49pm
Print Post  
Tim,

I didn't install anything via the board manager.  As you stated, it was automatically updated when the Arduino IDE was updated.   

Based on some other posts I had run across, it appeared that the latest IDE avr board manager update (1.6.23) might have been the cause of the problem, so I (using the Arduino board manager tool) reverted from V1.6.23 to 1.6.21 and (at the time) thought this might have been the 'fix'. Unfortunately, later experience seemed to indicate that the V1.6.23 update was not the culprit, so I UNinstalled 1.6.21 and re-installed 1.6.23, putting everything back the way it was at the time of the latest IDE update.

Will the Arduino IDE recreate whatever it needs to if I delete the folder you suggested?

Regards,

Frank
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: warning: type 'struct MPU6050' violates one definition rule [-Wodr]
Reply #6 - Jan 29th, 2019 at 6:26pm
Print Post  
It sounds like you are just talking about what warning level is passed to the compiler?
  
Back to top
WWW  
IP Logged
 
FrankP
Full Member
***
Offline


Posts: 240
Joined: Oct 19th, 2011
Re: warning: type 'struct MPU6050' violates one definition rule [-Wodr]
Reply #7 - Jan 29th, 2019 at 11:08pm
Print Post  
Tim,

Well, you are probably correct in that I probably could suppress the warning with the appropriate string added to the 'extra cpp flags' field (like I do now with -Wno-unknown-pragmas to suppress #pragma warnings), but I haven't ever had to do this in the past, and I've been using this code for months if not years.  Something clearly changed within the last few months (6 months tops) since the last time I was working with my autonomous robot code, and for the life of me I can't figure out what.

It may be that the change, whatever it was, just highlighted a problem that was there all the time, and now I'm chasing a ghost (a very very irritating ghost!).

However, the bottom line for me is - unexplained warnings need to be addressed, and it's driving me crazy that this one seems to defy all efforts to eradicate it  Angry

Frank
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: warning: type 'struct MPU6050' violates one definition rule [-Wodr]
Reply #8 - Jan 29th, 2019 at 11:21pm
Print Post  
This is down to your code of the version of the compiler.

You can use the verbose option both arduino ide and visual micro to see what warning param is set. Both IDE's offer some control over them via menus/dialogs.

You have not said if you have the visual micro warnings setting on or off?
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint