Skip to content

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

Closed
@nickgammon

Description

@nickgammon

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

Metadata

Metadata

Assignees

Labels

Component: IDEThe Arduino IDEComponent: PreprocessorThe Arduino sketch preprocessor converts .ino files into C++ code before compilation

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions