Welcome, Guest. Please Login or Register
Arduino IDE for Visual Studio
 
 
When Logging a Support Issue in the Forum, please ensure you have also:-
  • Enabled vMicro > Compiler > Show Build Properties and Verbose
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
Support requests without the output above may be impossible to answer, so please help us to help you
 
  HomeSearch Tutorials & Wiki visualmicro.com LoginHelpRegister  
 
Page Index Toggle Pages: 1
Send Topic Print
Issue with libraries (Read 5604 times)
Massimo S
Junior Member
**
Offline



Posts: 13
Issue with libraries
Aug 13th, 2015 at 11:10pm
 
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:
#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:
#include<AltSoftSerial\AltSoftSerial.h> 



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


then it does give me a syntax error on

Code:
AltSoftSerial test1; 



Can you please help me? I do really feel dummy


Note that this

Code:
#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.
Back to top
« Last Edit: Aug 13th, 2015 at 11:11pm by Massimo S »  
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10146
United Kingdom
Re: Issue with libraries
Reply #1 - Aug 13th, 2015 at 11:23pm
 
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
Re: Issue with libraries
Reply #2 - Aug 14th, 2015 at 8:55am
 
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
 
Visual Micro
Administrator
*****
Offline



Posts: 10146
United Kingdom
Re: Issue with libraries
Reply #3 - Aug 14th, 2015 at 2:49pm
 
The correct include should be:-

Code:
#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
Back to top
« Last Edit: Aug 14th, 2015 at 3:06pm by Visual Micro »  
WWW  
IP Logged
 
Massimo S
Junior Member
**
Offline



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



and now it worked... very weird!

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



Posts: 10146
United Kingdom
Re: Issue with libraries
Reply #5 - Aug 14th, 2015 at 3:05pm
 
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.
Back to top
« Last Edit: Aug 14th, 2015 at 3:07pm by Visual Micro »  
WWW  
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10146
United Kingdom
Re: Issue with libraries
Reply #6 - Aug 14th, 2015 at 5:42pm
 
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:
#include <lib.h>
#include "lib.h" 



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



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