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 Conditional libraries (Read 5457 times)
f1oat
Newbies
*
Offline


Posts: 4
Joined: Jun 13th, 2016
Conditional libraries
Jun 13th, 2016 at 8:48pm
Print Post  
I am trying to link to different libraries depending on target board. In my INO file I have:

#ifdef CONTROLLINO_MAXI
#include <Ethernet.h>
#include <Controllino.h>
#else
#include <EthernetV2_0.h>
#define SDCARD_CS 4
#endif

The compiler is complaining about multiple definition of some symbols. In fact, both Ethernet and EthernetV2_0 are linked.
If I comment out one of the two includes, everything is fine.

Looks like vMicro does not take care of #ifdef directives when evaluating the libraries to be linked with.
Any idea ?
Thanks.
Frederic.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Conditional libraries
Reply #1 - Jun 13th, 2016 at 9:40pm
Print Post  
Is "vMicro>compiler>deep search includes" switched on?
  
Back to top
IP Logged
 
f1oat
Newbies
*
Offline


Posts: 4
Joined: Jun 13th, 2016
Re: Conditional libraries
Reply #2 - Jun 13th, 2016 at 10:05pm
Print Post  
No, deep search is not activated.

If I activate it, then the compiler cannot find some headers:

"C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avr-g++" -c -g -Os -w -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10608 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -I"C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" -I"C:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\mega" -I"P:\ARDUINO\Arduino\libraries\Streaming" -I"P:\ARDUINO\Arduino\libraries\TextFinder" -I"C:\Program Files (x86)\Arduino\libraries\SD\src" -I"C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src" -I"P:\ARDUINO\Arduino\libraries\Flash-5" -I"P:\ARDUINO\Arduino\libraries\TimerOne" -I"P:\ARDUINO\Arduino\libraries\EthernetV2_0" "P:\ARDUINO\Arduino\libraries\EthernetV2_0\DhcpV2_0.cpp" -o "nul"

P:\ARDUINO\Arduino\libraries\EthernetV2_0\DhcpV2_0.cpp:4:19: fatal error: w5200.h: No such file or directory
#include "w5200.h"


w5200.h is located in "P:\ARDUINO\Arduino\libraries\EthernetV2_0\utility"

I can try to patch this library to add the path. But as it is a third party lib fully working with Arduino IDE, that could be dangerous for future upgrades.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Conditional libraries
Reply #3 - Jun 14th, 2016 at 10:54am
Print Post  
Okay that's a bug and will be fixed over the next 24/48

The deep search is responsible for more intelligent filtering of headers so will be required in your case.

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


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Conditional libraries
Reply #4 - Jun 14th, 2016 at 8:26pm
Print Post  
The new deep search system was missing support for the \utility folder of older v1 arduino libraries

Hopefully you find this is fixed in the latest release? (1606.14)
« Last Edit: Jun 16th, 2016 at 10:13pm by Tim@Visual Micro »  
Back to top
IP Logged
 
f1oat
Newbies
*
Offline


Posts: 4
Joined: Jun 13th, 2016
Re: Conditional libraries
Reply #5 - Jun 16th, 2016 at 7:29pm
Print Post  
Thank you for the quick fix.
It works well now!
Frederic.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint