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 Stumped - link error (Read 2010 times)
International man of mystery
Newbies
*
Offline


Posts: 2
Joined: Mar 1st, 2017
Stumped - link error
Mar 1st, 2017 at 1:42am
Print Post  
First time creating a user library.  Here are the salient bits:
in mySketch.ino:

#define DEBUG
#include <mylib.h>

in mylib.h:
#ifdef DEBUG
     #undef UART
     const int RX_PIN = 10;
     const int TX_PIN = 11;
#else
     #define UART
#endif
     
#ifdef UART
     #define SERIAL Serial
#else
     #include <SoftwareSerial.h>
     SoftwareSerial mySerial(RX_PIN, TX_PIN);
     #define SERIAL mySerial
#endif

in mylib.cpp:
void func()
{
#ifndef UART
     pinMode(RX_PIN, INPUT);
     pinMode(TX_PIN, OUTPUT);
#endif

     SERIAL.begin( BAUD_RATE );
...
}

Here's the error I get:
Error linking for board Arduino/Genuino Uno
mylib.cpp.o (symbol from plugin)*: In function mySerial
Debug build failed for project 'MySketch'
(.text+0x0)*: multiple definition of mySerial
MySketch.cpp.o (symbol from plugin)*: (.text+0x0): first defined here
 
collect2.exe*: error: ld returned 1 exit status
  
Back to top
 
IP Logged
 
International man of mystery
Newbies
*
Offline


Posts: 2
Joined: Mar 1st, 2017
Re: Stumped - link error
Reply #1 - Mar 1st, 2017 at 2:52am
Print Post  
O lordy. Never mind - been out of the trenches for too long. Moved the mySerial declaration into the CPP. Solved.  Embarrassed
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint