VS Arduino
>> >> Issue with libraries
https://www.visualmicro.com/forums/YaBB.pl?num=1439503851

Message started by Massimo S on Aug 13th, 2015 at 10:10pm

Title: Issue with libraries
Post by Massimo S on Aug 13th, 2015 at 10: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 */
}
[/code):



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"[/code):

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 */
}
[/code]

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.

Title: Re: Issue with libraries
Post by Visual Micro on Aug 13th, 2015 at 10: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

Title: Re: Issue with libraries
Post by Massimo S on Aug 14th, 2015 at 7: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

Title: Re: Issue with libraries
Post by Visual Micro on Aug 14th, 2015 at 1:49pm
The correct include should be:-

[code]#include <AltSoftSerial.h>[/code]

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

Title: Re: Issue with libraries
Post by Massimo S on Aug 14th, 2015 at 1:57pm
Ok.
I did cancelled the line and used the AddLibrary / User it added a line
[code]
#include <AltSoftSerial.h>
[/code]

and now it worked... very weird!


Title: Re: Issue with libraries
Post by Visual Micro on Aug 14th, 2015 at 2: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 :)

???


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.

Title: Re: Issue with libraries
Post by Visual Micro on Aug 14th, 2015 at 4: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"[/code):



This fails:-
[code]#include<lib.h>
#include"lib.h"


Thanks for the report

VS Arduino » Powered by YaBB 2.6.12!
YaBB Forum Software © 2000-2024. All Rights Reserved.