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 Issue with libraries (Read 7230 times)
Massimo S
Junior Member
**
Offline


Posts: 13
Joined: Aug 13th, 2015
Issue with libraries
Aug 13th, 2015 at 10:10pm
Print Post  
Sorry team but I feel dummy... I'm not able to get my simple code compile.
I've read all the documentation etc...

This is the code:

Code
Select All
#include"AltSoftSerial\AltSoftSerial.h"
AltSoftSerial test1;

void setup()
{
  /* add setup code here */
}

void loop()
{
  /* add main program code here */
}
 



I get this error:
Quote:
Compiling 'test1' for 'Arduino Yún'
test1.ino:1:40: fatal error: AltSoftSerial\AltSoftSerial.h: No such file or directory
Error compiling


The first line is compiled with the autocomplete functionality, so it should be correct.

I've tried to add the library manually, from the menu, from the library manager... in all possible ways... always get the error.

I get the same error with:
Code
Select All
#include<AltSoftSerial\AltSoftSerial.h> 



If I change it to this:
Code
Select All
#include"AltSoftSerial.h" 


then it does give me a syntax error on

Code
Select All
AltSoftSerial test1; 



Can you please help me? I do really feel dummy


Note that this

Code
Select All
#include<AltSoftSerial.h>
AltSoftSerial test1;

void setup()
{
  /* add setup code here */
}

void loop()
{
  /* add main program code here */
}
 



compiles correctly in the arduino ide 
Quote:

Sketch uses 1,718 bytes (5%) of program storage space. Maximum is 28,672 bytes.
Global variables use 201 bytes (9%) of dynamic memory, leaving 1,847 bytes for local variables. Maximum is 2,048 bytes.

but does not compile in Visual Studio


I followed the standard configuration on the Visual Studio plugin.
« Last Edit: Aug 13th, 2015 at 10:11pm by Massimo S »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Issue with libraries
Reply #1 - Aug 13th, 2015 at 10:23pm
Print Post  
Hi,

If you open the visual micro ide locations window you will see that you specified the location of the arduino ide.

Below the ide location field is an optional field called sketchbook folder.


Is the field empty or does it contain a value?

Which version of the arduino ide are you using?


Thanks
  
Back to top
WWW  
IP Logged
 
Massimo S
Junior Member
**
Offline


Posts: 13
Joined: Aug 13th, 2015
Re: Issue with libraries
Reply #2 - Aug 14th, 2015 at 7:55am
Print Post  
I left the dafeault configuration so the sketchbook folder is empty.

For the version I left the default option and it should be Arduino 1.6

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


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Issue with libraries
Reply #3 - Aug 14th, 2015 at 1:49pm
Print Post  
The correct include should be:-

Code
Select All
#include <AltSoftSerial.h> 



But you should use the menus to insert it for you so you can see the format and ensure the library is being discovered.

Remove the #include and then click "Project>Add Arduino Library". Do you see the library on the User or Core menu?

If not, open the "Micro Explorer", expand your board and tell me if you see the library listed under libraries?

If you can not see the library can you confirm it exists in c:\users\[your name]\documents\arduino\AltSoftSerial.h
« Last Edit: Aug 14th, 2015 at 2:06pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Massimo S
Junior Member
**
Offline


Posts: 13
Joined: Aug 13th, 2015
Re: Issue with libraries
Reply #4 - Aug 14th, 2015 at 1:57pm
Print Post  
Ok. 
I did cancelled the line and used the AddLibrary / User it added a line 
Code
Select All
#include <AltSoftSerial.h>
 



and now it worked... very weird! 

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


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Issue with libraries
Reply #5 - Aug 14th, 2015 at 2:05pm
Print Post  
Thanks, I will look into it. Maybe it's a problem with " instead of < or maybe that you did not have a any whitespace between #include and "lib.h"

You can try it easily enough. Now you know the correct syntax/format you can easily make it work or break it Smiley

???


by the way, unlike visual micro, the arduino ide does not show an error if it can not find a library but the library can't be used.
« Last Edit: Aug 14th, 2015 at 2:07pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Issue with libraries
Reply #6 - Aug 14th, 2015 at 4:42pm
Print Post  
I tested this. 

If there is no space/tab/gap between the #include and the <library.h> or "library.h" then Visual Micro fails to compile

This works:-
Code
Select All
#include <lib.h>
#include "lib.h" 



This fails:-
Code
Select All
#include<lib.h>
#include"lib.h" 



Thanks for the report
« Last Edit: Aug 14th, 2015 at 4:43pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint