Go Down

Topic: Define Syntax for #include "RTCLib.h" or #include <RTCLib.h> (Read 2042 times) previous topic - next topic

Loonhaunt

Before wasting a lot of peoples time, and words perhaps someone can explain the syntax difference in the two library inclusion statements above. 

I was working with a tutorial program for data logging, and had uploaded a sketch to my Uno, all was working and logging except that the RTC was still stamping with its default date and time.  I had even run an adjust sketch to get it running prior to the main file that I uploaded to perform the logging.   I got the same result.   Default 2000/xx/xx.  So I arbitrarily change the syntax of the #include statement of the tutorial which I downloaded from #include "RTCLib.h"   to #include <RTCLib.h>, and as soon as I uploaded everything functioned perfectly!   What's the deal?  There was no mention of any requirement to edit that line in the comments, and I have been looking everywhere for an explanation and am unable to find one.

No big deal, I got the code to work, but I would like to know why?

db

Brduino

#1
Aug 19, 2014, 01:42 am Last Edit: Aug 19, 2014, 01:44 am by Brduino Reason: 1
Hello Loonhaunt (and the whole community, by the way ;)),

I'm also a newbie and had the same question. Since Aduino seems to be "some kind od C/C++" I've done my research on that languages and it seems to be applicable to Arduino.

Quote from: http://www2.informatik.uni-halle.de/lehre/c/c_includ.html

(roughly translated from German)

The difference between <header_name> and "header_name" lies in the strategy used to find the include file.
  • <header_name>
    This form specifies a default include file. The compiler will search for it successively in all default directories (in the order of their definitions). An error is raised if it can't be found.


  • "header_name"
    This form specifies a user defined include file. It may be used with a absolute or relative path. If it can't be found, then the compiler will search for it the same way like if <header_name> is used.



Go Up