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) Removing a library? (Read 8915 times)
hb
Newbies
*
Offline


Posts: 5
Joined: Nov 9th, 2015
Removing a library?
Nov 9th, 2015 at 8:40pm
Print Post  
How can I remove a library? I had the Ethernet Shield R3, which uses Ethernet library, but I recently changed it to Ethernet Shield v2, which uses Ethernet2 library.

If I add both libraries, w5100.h and w5500.h go berserk. How can I remove a library? I've tried modifying the project file by hand, but VisualMicro keeps re-adding it.
« Last Edit: Nov 9th, 2015 at 8:43pm by hb »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Removing a library?
Reply #1 - Nov 9th, 2015 at 9:25pm
Print Post  
Hi,

You are right to remove a library you simply remove the #include(s) from the [skecth_name].ino

Visual Micro doesn't re-add #includes when you remove them but there is a situation that can be confusing....

After a compiler error you double clicked an error to go to the code. Sometimes this takes you to the temp compiler version of the code instead of your real .ino code. The temp copy will have an extension of .cpp and not .ino but it's not always obvious.

So close all open documents. Then open your .ino code file to ensure it's your one. Then remove the #includes.

Does this help?

  
Back to top
WWW  
IP Logged
 
hb
Newbies
*
Offline


Posts: 5
Joined: Nov 9th, 2015
Re: Removing a library?
Reply #2 - Nov 9th, 2015 at 9:27pm
Print Post  
Thing is, both ethernet and ethernet2 libraries have the same include: Ethernet.h.

I need to remove Ethernet's include directories, but I don't see any way to do so other than modifying the vcxproj... and that doesn't help, either.


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


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Removing a library?
Reply #3 - Nov 9th, 2015 at 9:35pm
Print Post  
Oh I see I'm sorry I misunderstood. This is a problem for arduino normally however it is improving slowly. It is normally important for arduino that a library contains a .h of the same name.

In visual micro you specify includes more exactly

Code
Select All
#include "Ethernet2\Ethernet.h" 



Do the same for all the #includes in the .ino code that relate to Ethernet2
« Last Edit: Nov 9th, 2015 at 9:39pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
hb
Newbies
*
Offline


Posts: 5
Joined: Nov 9th, 2015
Re: Removing a library?
Reply #4 - Nov 9th, 2015 at 9:39pm
Print Post  
That works, but I'd still like to remove the include folder, to avoid any possible code conflicts (Might be overkill, I know)

Library Include Paths (6)
Include Path 'D:\Documents\Arduino\libraries\Adafruit_NeoPixel-master'
Include Path 'D:\Documents\Arduino\libraries\Adafruit-PN532-master'
Include Path 'C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM'
Include Path 'C:\Program Files (x86)\Arduino\libraries\Ethernet\src'
Include Path 'C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI'
Include Path 'C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire'

Just want to make sure that no incorrect files are being picked up.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Removing a library?
Reply #5 - Nov 9th, 2015 at 9:59pm
Print Post  
No you are right that looks like a bug. I will look into it.

Thanks
  
Back to top
WWW  
IP Logged
 
hb
Newbies
*
Offline


Posts: 5
Joined: Nov 9th, 2015
Re: Removing a library?
Reply #6 - Nov 9th, 2015 at 10:00pm
Print Post  
In the meantime, where do you save added libraries? Worst case, I'll re-create this sketch w/o that library...
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Removing a library?
Reply #7 - Nov 9th, 2015 at 10:13pm
Print Post  
It's not related to any saving of libraries. Consider the fact that with arduino you do not specify the location of any libraries. They are automatically discovered which is why a golden rule is to have the library folder name and header.h name to be the same.

The name of the headers is used to find libraries in the known legal locations. In your case it would be correct that #include "ethernet.h" resolved primarily to your installed library folder called "Ethernet". 

The fact that Ethernet2 contains the ethernet.h header means that Arduino is always going to have a problem. 

The path you are seeing is the real legal path, in arduino terms, of where you have installed a library. The bug is that even if you #include "libName\header" visual micro is defaulting to native arduino and resolving the path of Ethernet.

It might be the arduino ide resolves this slightly differently which would be interesting to know but it's still a confused situation.

You have a few choices:-

1) Remove the Ethernet library from your arduino installation

or

2) Rename Ethernet2 to Ethernet. If Ethernet2 is in the "mydocuments/arduino/libraries" folder it should override the pre-installed version.

or

3) Rename the enternet.h and .cpp in Ethernet2 to to Ethernet2.h and Ethernet2.cpp changing the #includes in any of it's sources.

For the change to take effect,  click the Rescan button on the Visual Micro Explorer or restart the Ide.
  
Back to top
WWW  
IP Logged
 
hb
Newbies
*
Offline


Posts: 5
Joined: Nov 9th, 2015
Re: Removing a library?
Reply #8 - Nov 9th, 2015 at 10:15pm
Print Post  
My bad - Ethernet2 does have Ethernet2.h. Either way, seems that both Eth and Eth2 have similar libraries, so having the include path for the other one (instead of the correct one) messes up the detection. Hope that helps.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Removing a library?
Reply #9 - Nov 9th, 2015 at 11:04pm
Print Post  
Oh. 

If you are saying you have Ethernet.h and Ethernet2.h in the same lib then ensure Ethernet2.h is #included before the other. Visual Micro uses the order of the includes in an attempt to provide some additional control. For example:-

The Ethernet2 library will be used in preference to the Ethernet library. This assumes that both header files exist in the Ethernet2 library

Code
Select All
#include "Ethernet2.h"
#include "Ethernet.h"
 



This would be a problem with your config because the Ethernet library would be discovered before Ethernet2:-

Code
Select All
#include "Ethernet.h"
#include "Ethernet2.h" 

« Last Edit: Nov 9th, 2015 at 11:11pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint