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) ld.exe:Disabling relaxation: it will not work with multiple definiti (Read 21213 times)
Kucky
Junior Member
**
Offline


Posts: 50
Location: Germany
Joined: Oct 12th, 2012
ld.exe:Disabling relaxation: it will not work with multiple definiti
Oct 2nd, 2014 at 9:26am
Print Post  
Hello,
I use the Lib "MPU6050" in a project. Everything works fine. 
But the MPU setup runs in the main (ino) file. The MPU data 
read from the main loop. (See MPU6050 example). 
I want the MPU6050-Lib in a separate project class 
to use.
Looks like this:
void IMUClass::init()   (from main setup)
{
    Serial.println(F("Initializing I2C devices..."));
    mpu.initialize();
etc.
}

void IMUClass::readMPU()(from main loop)
{
    mpuInterrupt = false;
    mpuIntStatus = mpu.getIntStatus();
    fifoCount = mpu.getFIFOCount();
etc.
}
If I all includes (MPU6050_9Axis_MotionApps41.h …), declarations and initializations in my class 
have defined, comes this message.
Compiling 'MPU9150_Test' for 'Arduino Mega 2560 or Mega ADK'
MPU9159Class.cpp.o:In function `MPU6050::dmpGetAccel(long*, unsigned 
char const*)'
MPU6050_9Axis_MotionApps41.h:dmpGetAccel(long*, unsigned char const*)'
MPU9150_Test.cpp.o:\MPU6050_9Axis_MotionApps41.h:636: first defined here
ld.exe:Disabling relaxation: it will not work with multiple definitions

I understand what the compiler says, but how do I disable the error?

The Libs
#include "MPU6050_9Axis_MotionApps41.h"
#include "helper_3dmath.h"
#include "I2Cdev.h"
located in the project directory. I work with VS + Visual Micro and Arduino IDE.

I'm really desperate. Cry
Regards
Willi
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12164
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ld.exe:Disabling relaxation: it will not work with multiple definiti
Reply #1 - Oct 2nd, 2014 at 12:11pm
Print Post  
Hi Kucky

Does it work in the Arduino IDE?

thanks
  
Back to top
IP Logged
 
Kucky
Junior Member
**
Offline


Posts: 50
Location: Germany
Joined: Oct 12th, 2012
Re: ld.exe:Disabling relaxation: it will not work with multiple definiti
Reply #2 - Oct 2nd, 2014 at 12:19pm
Print Post  
Hey Tim,
Thanks for the quick response.
I have not tried  Undecided. I test today. Can it be?

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


Posts: 12164
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ld.exe:Disabling relaxation: it will not work with multiple definiti
Reply #3 - Oct 2nd, 2014 at 12:20pm
Print Post  
The same code should fail in the Arduino Ide. When you have confidence of the compatibility between arduino and visual micro projects you can ask the same question in the arduino.cc/forum which is the best place for help with your code.

thanks
  
Back to top
IP Logged
 
Kucky
Junior Member
**
Offline


Posts: 50
Location: Germany
Joined: Oct 12th, 2012
Re: ld.exe:Disabling relaxation: it will not work with multiple definiti
Reply #4 - Oct 2nd, 2014 at 12:23pm
Print Post  
I did that of course. But there I got no answer. See you later.
Willi
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12164
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ld.exe:Disabling relaxation: it will not work with multiple definiti
Reply #5 - Oct 2nd, 2014 at 12:29pm
Print Post  
Your .he file needs to be surrounded with an 

#ifndef MYCLASS
#define MYCLASS

try right clicking the project in solution explorer then selecting the visual micro add new "cpp code" option. When prompted give the new class a name of "MyExampleClass". then look at the cpp and .h file that are created for you. Some of the syntax won't be required but the framework for creating a class should be laid out clearly in the new files.
  
Back to top
IP Logged
 
Kucky
Junior Member
**
Offline


Posts: 50
Location: Germany
Joined: Oct 12th, 2012
Re: ld.exe:Disabling relaxation: it will not work with multiple definiti
Reply #6 - Oct 2nd, 2014 at 12:50pm
Print Post  
Thank you for your interest. I think I did it correctly. Can I attach my solution here?
Willi
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12164
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ld.exe:Disabling relaxation: it will not work with multiple definiti
Reply #7 - Oct 2nd, 2014 at 1:54pm
Print Post  
Yes
  
Back to top
IP Logged
 
Kucky
Junior Member
**
Offline


Posts: 50
Location: Germany
Joined: Oct 12th, 2012
Re: ld.exe:Disabling relaxation: it will not work with multiple definiti
Reply #8 - Oct 2nd, 2014 at 7:05pm
Print Post  
Sorry, I can not find the fileattach-button. Embarrassed


  
Back to top
 
IP Logged
 
Kucky
Junior Member
**
Offline


Posts: 50
Location: Germany
Joined: Oct 12th, 2012
Re: ld.exe:Disabling relaxation: it will not work with multiple definiti
Reply #9 - Oct 2nd, 2014 at 7:24pm
Print Post  
*.ino
Code (C++)
Select All
#include <Wire.h>
#include "I2Cdev.h"
#include "MPU6050_9Axis_MotionApps41.h"
#include "MPU9150.h"


void setup()
{
  Serial.begin(38400);
  MPU9150.init();
}

void loop()
{
  MPU9150.readIMU();
}
 



MPU9150Class *.cpp
Code (C++)
Select All
#include "MPU9150.h"

// Declare device MPU6050 class
MPU6050 mpu;


uint16_t count = 0;  // used to control display output rate
//...


void MPU9150Class::init()
{
 // setup the IMU here
}

void MPU9150Class::readIMU() {
//read somthing here

}

void MPU9150Class::MadgwickQuaternionUpdate(float ax, float ay, float az, float gx, float gy, float gz, float mx, float my, float mz)
{
 // calculating something
}
MPU9150Class MPU9150;
 



MPU9150Class *.h
Code (C++)
Select All
// MPU9150.h

#ifndef _MPU9150_h
#define _MPU9150_h

#if defined(ARDUINO) && ARDUINO >= 100
	#include "Arduino.h"
#else
	#include "WProgram.h"
#endif

#include <Wire.h>
#include "I2Cdev.h"
#include "MPU6050_9Axis_MotionApps41.h"


class MPU9150Class
{
 protected:

 public:

	int16_t a1, a2, a3, g1, g2, g3, m1, m2, m3;     // raw data arrays reading
	//...

	void init();
	void readIMU();
	void MadgwickQuaternionUpdate(float, float, float, float, float, float, float, float, float);
};

extern MPU9150Class MPU9150;

#endif

In Project folder:
#include "I2Cdev.h"
#include "MPU6050_9Axis_MotionApps41.h"
including *.cpp files

#include "MPU9150.h"
#include "MPU9150.cpp"
 



Error message:
Compiling 'MPU9150_test2' for 'Arduino Mega 2560 or Mega ADK'
MPU9150_test2.cpp.o:In function `MPU6050::dmpGetAccel(long*, unsigned char const*)'
MPU6050_9Axis_MotionApps41.h:dmpGetAccel(long*, unsigned char const*)'
MPU9150.cpp.o:\MPU6050_9Axis_MotionApps41.h:636: first defined here
ld.exe:Disabling relaxation: it will not work with multiple definitions

Can you see anything?

Willi


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


Posts: 12164
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ld.exe:Disabling relaxation: it will not work with multiple definiti
Reply #10 - Oct 3rd, 2014 at 4:41pm
Print Post  
Sorry about the missing attachments button. Please click "choose file" in a new post below, this will now allow attachments.

Thanks
  
Back to top
IP Logged
 
Kucky
Junior Member
**
Offline


Posts: 50
Location: Germany
Joined: Oct 12th, 2012
Re: ld.exe:Disabling relaxation: it will not work with multiple definiti
Reply #11 - Oct 3rd, 2014 at 7:33pm
Print Post  
Hey,
thanks.....
Here my code. But without solution, right?

Willi
  

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


Posts: 12164
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ld.exe:Disabling relaxation: it will not work with multiple definiti
Reply #12 - Oct 3rd, 2014 at 9:13pm
Print Post  
Hi,

The MPU6050_9Axis_MotionApps41.h probably worked okay when it was a library but now you have copied it locally you should the easiest thing is to split MPU6050_9Axis_MotionApps41.h into MPU6050.h and MPU6050.cpp

The MPU6050_9Axis_MotionApps41.h contains cpp definitions which are declared in MPU6050.h
  
Back to top
IP Logged
 
Kucky
Junior Member
**
Offline


Posts: 50
Location: Germany
Joined: Oct 12th, 2012
Re: ld.exe:Disabling relaxation: it will not work with multiple definiti
Reply #13 - Oct 6th, 2014 at 7:57am
Print Post  
Hello,
sorry, I was not home for the weekend. Thanks for your respond.
That's exactly the problem. The example program so that operates without problems. I want to build a "sensor class", for multiple sensors, including also the MPU9150.
I wrote to the author of the library. Still no response. I think the problem is the library, and not in VM.
I'll try to extract the relevant code from the library.
Gruß
Willi
  

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


Posts: 50
Location: Germany
Joined: Oct 12th, 2012
Re: ld.exe:Disabling relaxation: it will not work with multiple definiti
Reply #14 - Oct 17th, 2014 at 7:34am
Print Post  
Hello,
The problem is solved. It was at the Library. Now i use another Library, and it works fine Cheesy.
Thanks for support.
Willi
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint