Project setup for navigating existing C/C++ code [message #1822046] |
Wed, 26 February 2020 05:03  |
Eclipse User |
|
|
|
Hi everyone
My background
I'm very new to using Eclipse CDT. I've used JDT quite a lot, though. I have some questions getting started. Hope you can help me.
Goal
For starters, I'd like to use Eclipse for browsing and navigating existing C/C++ code. I've found JDT quite superior in this and I hope to achieve the same with CDT.
I would like to ignore build tool settings and simply use Eclipse for parsing the code and showing warnings/errors and for navigating using F3 etc. Is this possible? Otherwise, I'd like some help setting this up too.
Out of tree project
I'd like to keep the .project file outside of the source tree, so I intent to use "Linked Resources". This option seems to be "grayed out" but I have managed to manually place it in the .project file. Can you explain why it is grayed out?
What I did
I hope you can guide me to a good start. I've tried, on and off, for a few days now, with different project types, and I can't seem to get it working very well.
The projects I work with are mainly a mix of make and cmake projects, using ARM compiler or MinGW GCC.
Example 1: C/C++ code using ARM compiler. I get a lot of "Symbol 'X' could not be resolved." although include paths seem to be set up correctly. F3 works most of the time, even on the "unresolved" symbols.
Example 2: C code using "Zephyr Project", also targeting ARM. Very simple code but I can't get Eclipse to accept my #include statements, e.g. #include zephyr.h even though I set up the include path.
If it would help, I can try setting up a project with details on how I did so it's easier to reproduce, but I'd like to get started in the right way first.
Questions I'd like answered - you probably know better :)
* Which project type to choose?
* Is it possible to use Eclipse only for parsing the code and navigating, i.e. with no build tools?
* How to diagnose problems like "Symbol 'X' could not be resolved."?
* What is the difference between "Create a new C or C++ project" and "Create a Project" -> "C/C++"?
* How to set include paths?
* Why is "Linked Resources" grayed out?
Thank you in advance.
Jacob
|
|
|
|
|
Re: Project setup for navigating existing C/C++ code [message #1822123 is a reply to message #1822094] |
Thu, 27 February 2020 10:52  |
Eclipse User |
|
|
|
The only real difference between a Makefile Project and a Managed Build Project is
the "Generate Makefile automatically" setting in Properties --> Project --> C/C++ Build --> Builder Settings tab
Disabling it sets the project as a Makefile Project.
You could create a C/C++ project then import the code but importing as a Makefile Project does all of that for you.
re: linked resources
What I have done in the past was to create a system folder and add files with soft links.
You can try using linked resources
https://help.eclipse.org/2019-12/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Ftasks%2Ftasks-45.htm
I think this creates the equivalent of soft links in the .project files.
I don't know why User Entries Add would be grayed out.
As far as I know, the Paths and Symbols tabs are to group tool settings and Preprocessor ... entries into one place.
Using them requires the "Preprocessor Include Paths, Macros, Etc." Managed Build Settings provider.
If you can't add links to User Entries using "Paths and Symbols" looks like a workaround.
|
|
|
Powered by
FUDForum. Page generated in 0.03310 seconds