Existing .h files error out on compile

I am new to programming, and don't know how to look for the cause of the following.

When compiling a sketch, I had several missing .h file errors listed, and found the files one by one, placing them into the directory, which appeared to be working.

In using Arduino 1.6.3 ( and 1.5.8 ), I have the following sketch compile error:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/chip.h:44:25: fatal error: include/adc.h: No such file or directory

But the file exists:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\adc.h

I added an include statement for chip.h, to get it compiled. chip.h apparently is dependent on adc.h, as that compile came up with the missing adc.h. I added an include for that, but it would not compile.

Strangely, if I switch the order of these includes in the sketch, the first will pass and the second one will fail.

What could be the problem?

fatal error: include/adc.h: No such file or directory

This looks like the compiler is looking for the adc.h file in the include folder.

It would help considerably if you posted a program that exhibits the problem.

This is the code without the mentioned includes.
Thanks,
Roger

USBasp_Test_Code.ino (545 Bytes)

Seeing the code without the includes is not much help when the problem is with the includes.

As I understand, includes are not required by the supplied code, as I provided here initially.

Here it is with the includes put back in.

Hope it helps...
Roger

USBasp_Test_Code.ino (581 Bytes)

Where exactly are the 2 header files located on your PC ? The syntax used in your program indicates that they should be in the same folder as your program file.

Why do you want/need to include them ?

I tried your sketch on Arduino 1.0.5 and 1.6.1 and it compiles with no problems.
I wonder about the pins you are using. Could you try it with pins 8, 9 and 10?

Also which board do you have selected in the Menu/tools/boards, and which Arduino board do you have?

After trolling for some information on the issue, I found the specified files in other libraries on the computer, and put them in the directories indicated in the error report and then added the includes to try to force recognition. That worked on some other missing .h files, but don't seem to work on the last adc.h

I have attached an image of the compile result...

Thanks,
Roger

As I understand, this sketch is just to test the USBasp v2.0 board which I have connected to com3, with USBDeview showing the USBasp as active and a red power led illuminated. I do not yet have the selected tinusaur board connected, but with or without the tinusaur board connected, the results are the same.

Thanks,
Roger

If the tinusaur board is not connected, which board IS connected?
In the tools/board menu select Arduino UNO or Nano, then try again WITHOUT the #include lines, if it still fails, try again using pins other than 14 through 18.

The error says there is a problem with "include adc.h", as it appears in chip.h, not as it appears in your program.

Have a look at chip.h, see what the #include for adc.h looks like in chip.h

It may be expecting adc.h to appear in a subdirectory called include.

I have the USBasp version 2 programmer board connected. I think this board is essentially used like an FTDI adapter, connecting to ATtiny MCU's. I am trying get set up to work with a Tinusaur ATtiny85.

Roger

FTDI adapter is a USB/Serial adapter to connect to Rx/Tx for serial interface (such as for Serial Monitor use when debugging).
USBAsp connects to SPI pins for bootloading, and code loading using File:Upload Using Programmer. No serial interface.
Two different tools.

michinyon,

OK, I had no idea... You have given me my first clue as to what to look for. I will take a look.

I am struggling to figure out a common structure for managing all the various files within this environment. I have acquired quite a number of little sketches and libraries for various purposes, and find that many do not follow a common location structure.

I would like to standardize file locations in my environment so that I can know where to find and put each file type and ensure the compiler will find them. Is there some sort of documented 'style' guide for this purpose around?

Thanks,
Roger

CrossRoads,

Thanks for clarifying. I had a very vague idea... different ways to load programs. There is a lot to learn.

Roger

I would like to standardize file locations in my environment so that I can know where to find and put each file type and ensure the compiler will find them. Is there some sort of documented 'style' guide for this purpose around?

The standard file locations are as follows
Libraries which are part of the standard Arduino installation are in the libraries folder of the Arduino installation directory.

User contributed libraries go in the libraries folder of the Arduino sketches folder.

In both cases the folder name must match exactly with the .h and .cpp filenames and the IDE must be stopped and started after such libraries are installed.. The syntax for including these is
#include wibble.hand the libraries can be included using Sketch/Import Library from the IDE menu. System libraries will appear at the top of the displayed list followed by user contributed libraries.

Libraries that are only relevant to an individual program go in the same folder as the program and will appear as extra tabs in the IDE. The syntax for including these is

#include "wibble.h"

UKHeliBob,

Thanks for the overview. I think why I'm having library problems is that I installed Digistump's ATtiny libraries that use Arduino version 1.5.8 while having 1.6.3 previously installed, thus having two Arduino trees, apparently confusing the compiler.

I haven't been able to figure out how (if even possible) to merge the two installations into a single directory tree.

Any ideas, or documentation you could point out that addresses this issue?

Thanks,
Roger

The main reason that the library folders are used in the way they are is so that upgrading to a new version of the IDE or even having several versions installed and in use at the same time is possible as long as the same folder is used by all versions for sketches. System libraries, even if they are version specific, are available to the appropriate IDE, as are user contributed libraries and the latter do not need to be reinstalled after an upgrade.

Unless you really need 1.6.3 I suggest that you uninstall it and use 1.5.8