Go Down

Topic: Compiler continue to use commented out #include headers (Read 7369 times) previous topic - next topic

nickgammon


After unzipping the Menu library it was recognized by IDE , added to editor file using Import Library and then it would not compile.

...

Unfortunately SAVING the file with uncommented #include files , now commented out, made the *.ino file useless!


This is, sadly, a mumbo-jumbo report.

Quote
After unzipping the Menu library ...


What library? Link? Where did you unzip it to?

Quote
... then it would not compile.


With what error messages? What did you compile, exactly?

Quote
This is pretty much known behavior ...


Oh? Link to this known behaviour?

Quote
and can be fixed by moving the files into Arduino libraries


What files? Where were they before?

Quote
after commenting out the #include code the compiler continue to use these commented out headers!


Proof?

Quote
Spitting out tons of errors caused by wrong enviroment path.


What errors? Copy and paste them here.

What environment path are you talking about?

Quote
it seems strange that basic C syntax is ignored.


What do you mean by that? What syntax? Prove it is ignored. Show the syntax. Show the "ignoring".

Quote
made the *.ino file useless


How can a file become useless?


Look, Vaclav, after over 400 posts you should know by now to not ramble on, but to paste your code and your error messages.
Please post technical questions on the forum, not by personal message. Thanks!

More info: http://www.gammon.com.au/electronics

bobcousins

I was mulling this over and I think bill has a workable suggestion which may have been overlooked:

Quote
The IDE could be smarter by doing the scan for includes for libraries and functions (to generate prototypes) in multiple passes.
The first pass would scan the sketch and would set up include paths for the c-pre processor (not the compiler)
Then run the c-prepressor with those include paths to do the only pre-processing on the sketch.
The second pass would scan the pre-processed file for the actual includes used and functions used.
Then the IDE could use that list of includes (which are the includes really used) and functions
and proceed just like does now.


To expand on what Bill said, the output of the preprocessor can be gotten using the "-E" flag. Although most of the source gets stripped, the "#line" directive is inserted into the output and specifies the source file, so that could be used to deduce what header files need including.

I'm not sure if that also helps with function prototypes, but I think it could help the include file problem. My java skills are minimal, but I will try to have a look at implementing this idea. I think it could be added as build step in Compile.java called when the libraries are being scanned for, instead of the regex currently done in PdeProcessor.java.

It's worth noting there are some major changes coming to the IDE, which will likely affect any implementation, but perhaps I can create a proof of principle.
Please ask questions in the forum so everyone can benefit. PM me for paid work.

Go Up