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 Cannot open source file "arduino.h" (Read 7582 times)
Bob Jones
Full Member
***
Offline


Posts: 210
Location: Bellingham, WA
Joined: Dec 4th, 2015
Cannot open source file "arduino.h"
May 14th, 2018 at 10:55pm
Print Post  
Just about all of my class libraries have a problem now because they cannot find the "arduino.h" file. I reinstalled the Arduino IDE (1.8.5) and have confirmed that this problem does not happen in the Arduino IDE - just in Visual Studio.

I have included a ZIP file that shows the problem. 

Thanks!

Bob
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Cannot open source file "arduino.h"
Reply #1 - May 14th, 2018 at 11:01pm
Print Post  
Thanks for the zip.

The compiler output in the zip shows successful compile and upload.

An extract from the compiler output in your zip is shown below.

Are you referring to intelllisense errors and not build errors? If so I don't understand the comparison with the Arduino IDE?

Looking at your zip some more is it possible you just need a few pointers?

Your zip contains a sketch project + a library project called SimpleJoystick in a sub folder below the sketch.

The #include "arduino.h" in the SimpleJoystick.h in the library

  • Libraries inherit the board of the "Startup Project" but only after you have added a "Reference" to the library from the startup project. 
  • Right click the Reference node of the "startup project" in the solution explorer and click "Add Reference". You will see the library listed under the "Shared Projects" tab. 
  • Now the code editor will know how to resolve intellisense?


Arduino libraries using Visual Studio shared library projects



Code
Select All
Program JoystickIncludeTest size: 2,218 bytes (used 7% of a 32,256 byte maximum) (4.26 secs)
Minimum Memory Usage: 266 bytes (13% of a 2048 byte maximum)

Uploading 'JoystickIncludeTest' to 'Arduino/Genuino Uno' using 'COM25'
Uploader started for board Arduino/Genuino Uno
Upload method will be: bootloader
Uploading via Bootloader
D:\Arduino\hardware\tools\avr\bin\avrdude "-CD:\Arduino\hardware\tools\avr/etc/avrdude.conf" -v -patmega328p -carduino "-PCOM25" -b115200 -D ickIncludeTest.ino.hex:i"
avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch
         System wide configuration file is "D:\Arduino\hardware\tools\avr/etc/avrdude.conf"
         Using Port                    : COM25
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
         AVR Part                      : ATmega328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
         Programmer Type : Arduino
         Description     : Arduino
         Hardware Version: 3
         Firmware Version: 4.4
         Vtarget         : 0.3 V
         Varef           : 0.3 V
         Oscillator      : 28.800 kHz
         SCK period      : 3.3 us
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: reading input file Test.ino.hex"
avrdude: writing flash (2218 bytes):
Writing | ################################################## | 100% 0.37s
avrdude: 2218 bytes of flash written
avrdude: verifying flash memory against est.ino.hex:
avrdude: load data flash data from input file est.ino.hex:
avrdude: input file est.ino.hex contains 2218 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 0.29s
avrdude: verifying ...
avrdude: 2218 bytes of flash verified
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: safemode: Fuses OK (E:00, H:00, L:00)
avrdude done.  Thank you.
	The upload process has finished. 

« Last Edit: May 14th, 2018 at 11:18pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Bob Jones
Full Member
***
Offline


Posts: 210
Location: Bellingham, WA
Joined: Dec 4th, 2015
Re: Cannot open source file "arduino.h"
Reply #2 - May 16th, 2018 at 7:59pm
Print Post  
Tim,

THANK YOU! It was the Add Reference I was missing. I am going back over other projects and adding that and my life is suddenly much easier.

Thanks again.

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


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Cannot open source file "arduino.h"
Reply #3 - May 16th, 2018 at 8:10pm
Print Post  
Great, yes VS is very happy with that Smiley
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint