Pages: [1]   Go Down
Author Topic: Include file is not parsed  (Read 1204 times)
0 Members and 1 Guest are viewing this topic.
Belgium
Offline Offline
Edison Member
*
Karma: 68
Posts: 1926
Arduino rocks; but with my plugin it can fly rocking the world ;-)
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi
I noticed that the Arduino IDE does not parse header files when defining the library paths.

I have 2 files. A include.h file and a include.pde file.
The include.h file looks like this:
Code:
#include <Servo.h>
The include.pde file looks like this:
Code:
#include "include.h"
Servo Myservo;

void setup() { }
void loop() {}
This does not compile in the arduino IDE

When I change the include.pde to look like this:
Code:
#include "include.h"
#include <Servo.h>
Servo Myservo;

void setup() { }
void loop() {}
it compiles

Is this considered to be a bug? Could this be fixed?

Best regards
Jantje
Logged

Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

0
Offline Offline
God Member
*****
Karma: 0
Posts: 593
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Arduino only looks for libraries to compile by using regex to search for #include in your code, if it can't find #include <Servo.h>, then it won't bother actually compiling it, and thus you will get errors about undefined references

see https://github.com/arduino/Arduino/blob/master/app/src/processing/app/preproc/PdePreprocessor.java for details about how this is actually done
Logged

Freelance engineer, consultant, contractor. Graduated from UW in 2013.

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 653
Posts: 50881
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Arduino only looks for libraries to compile by using regex to search for #include in your code
"code" is a bit too broad. It looks for #include statements in the sketch(es) only. It does not look in header files for other header files.
Logged

0
Offline Offline
God Member
*****
Karma: 26
Posts: 626
Always making something...
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I believe this is issue 236.

http://code.google.com/p/arduino/issues/detail?id=236

It's marked as accepted for 1.0, but nobody seems to have actually worked on it (yet).
Logged

Belgium
Offline Offline
Edison Member
*
Karma: 68
Posts: 1926
Arduino rocks; but with my plugin it can fly rocking the world ;-)
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I would be very pleased if this got fixed.
Best regards
jantje
Logged

Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

0
Offline Offline
God Member
*****
Karma: 26
Posts: 626
Always making something...
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Maybe this is the perfect opportunity (or motivation) for you to dig into the java code?

Arduino already parses the #include lines from the .pde files, to produce the list of libraries that need to be compiled.  So the "hard work" is already in there.  Code also already exists to build a list of all the .c and .cpp files.

Of all the possible IDE contributions, this one is probably one of the easiest for a beginner to make a significant contribution.
Logged

Belgium
Offline Offline
Edison Member
*
Karma: 68
Posts: 1926
Arduino rocks; but with my plugin it can fly rocking the world ;-)
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Paul
Good point. However I'll pass  smiley-cool . There is still plenty of work on my Arduino eclipse plugin
Best regards
Jantje
Logged

Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

Pages: [1]   Go Up
Jump to: