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
Normal Topic Error - Multiple definition of variable (Read 4381 times)
arduinoUser2
Junior Member
**
Offline


Posts: 41
Joined: Dec 30th, 2015
Error - Multiple definition of variable
Jan 19th, 2016 at 3:57pm
Print Post  
I am using Visual Micro 1601.11.4.

I am getting the following feedback from the "Micro Build" output window:

= = =
Compiling debug version of 'Temp_RH_WiFi_Arduino' for 'Arduino/Genuino Uno'
Email.cpp.o:(.bss.mySSID+0x0): multiple definition of `mySSID
Temp_RH_WiFi_Arduino.cpp.o:(.bss.mySSID+0x0): first defined here
Email.cpp.o:(.bss.myPasscode+0x0): multiple definition of `myPasscode
s\Temp_RH_WiFi_Arduino\uno\Temp_RH_WiFi_Arduino.cpp:45: first defined here

Temp_RH_WiFi_Arduino.cpp.o:In function `__static_initialization_and_destruction_0
Temp_RH_WiFi_Arduino.ino:~SoftwareSerial()
Temp_RH_WiFi_Arduino.cpp.o:In function `setup
Temp_RH_WiFi_Arduino.ino:begin(long)
Temp_RH_WiFi_Arduino.ino:listen()
Temp_RH_WiFi_Arduino.cpp.o:In function `__static_initialization_and_destruction_0
Temp_RH_WiFi_Arduino.ino:SoftwareSerial(unsigned char, unsigned char, bool)
Email.cpp.o:In function `__static_initialization_and_destruction_0
Email.cpp:WiFiClient()
Email.cpp.o:In function `sendEmail()
Email.cpp:connect(char const*, unsigned int)
Email.cpp:stop()
ESP8266_Functions.cpp.o:In function `ESP8266CmdResponse(char const*, unsigned long, unsigned long, SoftwareSerial&)
ESP8266_Functions.cpp:listen()
collect2.exe*:error: ld returned 1 exit status
Error creating .elf
= = =

The problem appears to be in the bolded, red lines.  I have checked the code, even changed the names of the variables.  There is only one place where they are declared and defined in .h files.  The .h files all have #include guards.

Is there something in the output messages that will tell me where the problem is?

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


Posts: 12204
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Error - Multiple definition of variable
Reply #1 - Jan 19th, 2016 at 5:07pm
Print Post  
Hi,

Have you manually included code from outside the sketch into your vs project? Such as the source code of a library? This would cause a double compile attempt for the linked sources.

If you don't think you have done this please zip and email your project folder to info[at]visualmicro.com

If you have done this and want to know how to use Visual Micro to view external source code references then say and I will explain how to.

  
Back to top
IP Logged
 
arduinoUser2
Junior Member
**
Offline


Posts: 41
Joined: Dec 30th, 2015
Re: Error - Multiple definition of variable
Reply #2 - Jan 19th, 2016 at 6:24pm
Print Post  
I think I have found the original problem.  I have another question.

Is the main Arduino .ino file just another .cpp file insofar as Visual Micro, or, for that matter, Visual Studio is concerned?

For example, if I have myProject.ino can I #include myProject.h within myProject.ino as I would any other .cpp file?

In Visual Studio I see a file called .myProject.vsarduino.h in the Visual Studio explorer, which is a Visual Micro generated file.  Would that interfere with an additional file .h file, e.g., myProject.h?

Thanks.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint