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

add eclipse CDT project with indexer includes #2649

Merged
merged 1 commit into from
Aug 11, 2015
Merged

Conversation

dagar
Copy link
Member

@dagar dagar commented Aug 6, 2015

This isn't perfect, but most things should now resolve within eclipse. You can build archives, px4fmu-v2_default or upload, but it's just calling the makefile.

@dagar dagar changed the title add eclipse CDT project with indexer includes [WIP] add eclipse CDT project with indexer includes Aug 6, 2015
@kd0aij
Copy link
Contributor

kd0aij commented Aug 6, 2015

Does this eliminate all "unresolved" warnings?
A related question is whether sublime-text provides the equivalent of Eclipse's "find all references" (right-click:References:Project) and, of course, whether it works for all symbols.

@dagar
Copy link
Member Author

dagar commented Aug 6, 2015

This doesn't eliminate all of them, but certainly the vast majority. For example commander and navigator aren't reporting any errors for me.

If you encounter something missing you probably need to add an include path to eclipse (C/C++ General -> Paths and Symbols -> Includes) or possibly a define.

Please give it a try and let me know if it works for you.

@kd0aij
Copy link
Contributor

kd0aij commented Aug 6, 2015

I show the symbol "OK" unresolved in commander.cpp, and can't find any includes referenced by commander.cpp which define it. (cherry-picked this commit into beta, created a new Eclipse workspace and imported the project)
I'm baffled both by the difference in Eclipse results and my inability to find where commander.cpp gets its definition of "OK".

@dagar
Copy link
Member Author

dagar commented Aug 6, 2015

Could you try a full rebuild of the index? Do other things resolve that weren't working before?

screenshot from 2015-08-06 14 08 06

@kd0aij
Copy link
Contributor

kd0aij commented Aug 6, 2015

I checked your branch out directly and (after a complete rebuild) there were initially no unresolved reference "errors" shown for commander.cpp
After restarting Eclipse, I see 40 occurrences of this error (Eclipse Luna 4.4.1, CDT 8.5.0):

Description Resource    Path    Location    Type
Function 'PX4_WARN' could not be resolved   commander.cpp   /PX4-Firmware/src/modules/commander line 284    Semantic Error

rebuilding the C index had no effect

@dagar
Copy link
Member Author

dagar commented Aug 6, 2015

Alright, so what we actually need to do is let eclipse build the project. I started with a fresh workspace, let the indexer finish and still had errors. After building px4fmu-v2_default from eclipse (which just calls the makefile) everything is resolving.

@dagar dagar changed the title [WIP] add eclipse CDT project with indexer includes add eclipse CDT project with indexer includes Aug 6, 2015
@kd0aij
Copy link
Contributor

kd0aij commented Aug 6, 2015

I find that if I uncheck a few boxes in Project Properties:C/C++ General:Code Analysis, all of the "unresolved" and "invalid arguments" errors go away. And "Open Declaration" and "References:Project" then work for the symbols which it claimed were unresolved.
codeanalysisoptions

@dagar
Copy link
Member Author

dagar commented Aug 7, 2015

Building from eclipse didn't resolve anything for you?
If not, we could disable those options for now. This is still worthwhile for eclipse users and can be improved over time.

@kd0aij
Copy link
Contributor

kd0aij commented Aug 7, 2015

Sorry, I meant all of the errors in the entire project went away with the change to the CodeAnalysis options. commander.cpp was clean before doing that.

@dagar
Copy link
Member Author

dagar commented Aug 7, 2015

It looks like the CodeAnalysis options are stored in the .settings/ directory which I'm not sure we should commit?
Any objection to committing just the .project and .cproject for now?

@kd0aij
Copy link
Contributor

kd0aij commented Aug 7, 2015

I think adding Eclipse project files is an improvement

@dagar
Copy link
Member Author

dagar commented Aug 7, 2015

@LorenzMeier This is good to go.

@LorenzMeier
Copy link
Member

I'll merge this if you put the rest of the things discussed onto the Eclipse wiki page and add a link in the README to both the eclipse and sublime pages 8).

@dagar
Copy link
Member Author

dagar commented Aug 7, 2015

Yes I'll update the wiki and add the missing targets to this PR. This should simplify the instructions nicely.

Do you mind if the "Automatic Initial Source Download" instructions (PX4 Toolchain → PX4 Software download) change to just using eclipse to clone which also imports the project?

@kd0aij
Copy link
Contributor

kd0aij commented Aug 7, 2015

I've been playing with this some more today. I removed your added include paths from .cproject but left the mods I suggested to CDT's CodeAnalysis settings, I'm still seeing no errors and only 7 warnings on the entire codebase. The warnings look correct...
eclipse_problems_tab

@kd0aij
Copy link
Contributor

kd0aij commented Aug 7, 2015

I'm curious to see whether you can reproduce this result...

@dagar
Copy link
Member Author

dagar commented Aug 7, 2015

Isn't that just trading a few cases where the indexer is confused to making them actually unresolved, but then not displaying the error?

@kd0aij
Copy link
Contributor

kd0aij commented Aug 7, 2015

No, all of the problem symbols I checked now resolve correctly. That's what I meant (above) by "And "Open Declaration" and "References:Project" then work for the symbols which it claimed were unresolved."
But see if it works for you; maybe I'm confused.

LorenzMeier added a commit that referenced this pull request Aug 11, 2015
add eclipse CDT project with indexer includes
@LorenzMeier LorenzMeier merged commit be58c6a into PX4:master Aug 11, 2015
@dagar
Copy link
Member Author

dagar commented Aug 11, 2015

I've been travelling, but I'll still get the wiki updated when I return.

On Tue, Aug 11, 2015 at 7:42 AM, Lorenz Meier [email protected]
wrote:

Merged #2649 #2649.


Reply to this email directly or view it on GitHub
#2649 (comment).

@dagar
Copy link
Member Author

dagar commented Aug 23, 2015

Eclipse wiki page updated.
https://pixhawk.org/dev/toolchain_installation_win

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants