Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include for "Arduino.h" inserted too late #1518

Closed
nickgammon opened this issue Jul 24, 2013 · 2 comments
Closed

Include for "Arduino.h" inserted too late #1518

nickgammon opened this issue Jul 24, 2013 · 2 comments
Assignees
Labels
Component: IDE The Arduino IDE Component: Preprocessor The Arduino sketch preprocessor converts .ino files into C++ code before compilation
Milestone

Comments

@nickgammon
Copy link

Example code ...

Sketch:

#include "test.h"

void setup () { }
void loop () { }

File "test.h":

byte x;

Error:

In file included from sketch_jul24c.ino:1:
test.h:1: error: 'byte' does not name a type

Generated code from pre-processor:

#line 1 "sketch_jul24c.ino"
#include "test.h"

#include "Arduino.h"
void setup ();
void loop ();
#line 3
void setup () { }
void loop () { }

If the include for "Arduino.h" had been done first (before the rest of the sketch was copied in) then the declarations in test.h would work. As it is, you now have to add an include into the front of all the .h files which defeats the usefulness of having the automatic inclusion in the main sketch.

IDE 1.0.5.

These look related:

#1310
#1328
#1468

@ffissore ffissore added the New label Feb 27, 2014
@cmaglie cmaglie removed the New label Feb 27, 2014
@ffissore ffissore added the Component: Preprocessor The Arduino sketch preprocessor converts .ino files into C++ code before compilation label May 28, 2015
@ffissore ffissore modified the milestones: Release 1.6.5, Release 1.6.6 Jun 15, 2015
@ffissore ffissore self-assigned this Jun 26, 2015
@nickgammon
Copy link
Author

Similar problem. In IDE 1.6.4:

#ifdef __AVR_ATmega2560__
  const byte CLOCKOUT = 11;  // Mega 2560
#else
  const byte CLOCKOUT = 9;   // Uno, Duemilanove, etc.
#endif

void setup () { }
void loop () { }

Error:

sketch_jun27a:8: error: 'byte' does not name a type
'byte' does not name a type

@ffissore
Copy link
Contributor

Fixed by #3779

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: IDE The Arduino IDE Component: Preprocessor The Arduino sketch preprocessor converts .ino files into C++ code before compilation
Projects
None yet
Development

No branches or pull requests

3 participants