In my checkout, there are many "C++ Eclipse projects".
To get Eclipse to index symbols, classes, etc. I manually add the paths to headers to each of these Eclipse C++ project folders in the Paths and Symbols menu.
Unfortunately, I cannot check in the .cproject files that contain this information so whenever I need to checkout a new copy . . . I have to redo everything.
QUESTION
How can I transfer these modifications to my "Path and Symbols" property of the Eclipse C++ project in the new checkout?
I haven't actually tried this, but it seems like File | Export | C/C++ | C/C++ Project Settings (and then Import the same into the new project) should work.
That said, it's worth noting that CDT has a feature that allows you to avoid manually specifying the include paths in Paths and Symbols to begin with: the build output parser.
The idea is that if your project uses a build system whose build output contains (or can be configured to contain) the full compiler invocation commands (things like g++ -I include/path/1 -I include/path/2 -o MyClass.o MyClass.cpp), CDT is able to parse this output and pick up the include paths automatically.
The build output parser can be configured in Project Properties | C/C++ General | Preprocessor Include Paths, Macros etc. | Providers | CDT GCC Build Output Parser (or replace GCC with whatever toolchain you're using).
This way, information about necessary include paths is contained in one place (your build script, e.g. makefile or similar, which presumably can be and is checked into the repository), and in each checkout of the project CDT's build output parser can pick up these settings automatically.
Related
I use CMake as a build manager for a C++ project. All my sources are in a src subdirectory, and I created a sibling build directory. Following the directions from https://cmake.org/Wiki/Eclipse_CDT4_Generator, the build commands I use are:
cd build
cmake -G"Eclipse CDT4 - Unix Makefiles" -D CMAKE_BUILD_TYPE=Debug ../src
This creates the .project and .cproject files used to import an existing project in Eclipse. In the IDE, everything seems to work perfectly, except that the make target does not work.
When I click on a build target, the CDT build console opens, but nothing occurs. Also when I click on Project / Clean in the Eclipse dropdown menus, nothing occurs. I checked the commands invoked by the targets, and they are of the form /usr/bin/make -j8, which should work.
Can anyone help me get the make target work ?
An automatic update to CDT just occurred and everything works now. So check for updates I guess.
Hope this is followed to create target....
The docs for eclipse says:
Your project name should be different from your executable name and different from your build folder name. Otherwise, Eclipse will NOT pick up your executable as you build them. Since my build folder name is certi_build, a CMakeLists.txt file like below should work (notice the difference in project name and executable name)
PROJECT(AwesomeProject)
ADD_EXECUTABLE(AwesomeProjectMain
main.cpp
util.h
util.cpp
)
I am trying to migrate a custom C++ project which uses Gtkmm3.0 to Eclipse (Oxygen) on Ubuntu 16.04. The project has its own Makefile and builds fine from the terminal within Eclipse. What I have not been able to do so far is tell the indexer about Gtkmm, and I get lots of these (which is very annoying):
When I hover over the little red bugs, it says:
Type 'Cairo::RefPtr<Cairo::Context>' could not be resolved.
I have done a lot of Googling on this and found nothing so far because all answers seem to assume the project's build tools are managed by Eclipse (See this or this, for example). In my case I have a makefile project instead of an executable project and hence some options are not available to me. For example, the first links speaks about configuring the builder:
We have to add all this directories. On Eclipse select the Project->Properties menu option. Select C/C++ Build->Settings property page and GNU C++ Compiler->Directories from the Tool Settings tab. Now we have to add all directories. In my case (Makefile project) only two tabs are available there: Binary Parsers and Error Parsers.
How can I tell the Eclipse indexer I am using Gtkmm3.0?
Found the solution that works for me:
Open a terminal and enter:
pkg-config --cflags gtkmm-3.0
You will see a list of includes directories (starting with -I). These are the directories you want to add in Eclipse so that it can locate the Gtkmm symbols in the editor.
In Eclipse, go to:
Project -> Properties -> C++ General -> Paths and Symbols
In the Includes tab, select GNU C++. You need to add here add the include directories found in step 1. There is no automated way to do this, yo must enter them one by one.
One trick that can save you some time is to edit manually the Eclipse project setting XML file and add the include directories directly in the XML file. By the end, you should have something that looks like this:
That did it for me, hope this helps!
Eclipse CDT offers autocompletion of your header files when you write new #include "something" statements.
In our project, we use -I. and require all includes to state full paths from the project base folder. Unfortunately, I cannot get the autocompletion of Eclipse to work in this way - it only seems to work when using relative paths to the current file. (once the whole file with its path is entered, there is no issue switching to it with F3, though).
My question now is, whether one can change some options to make Eclipse's autocompletion for includes work from the project base instead of only relative to the file?
In your project properties, add the root of your project to C/C++ General -> Paths and symbols under the Include tab.
I am now using eclipse to develop driver and daemon on android platform in C code with a pandaboard, and I want to use eclipse plus CDT as an edit and browse tool.
I have imported android-source code into eclipse as a makefile project, and processing with indexer.
My problem is, since there are lots of head files for different archetecture(x86, arm, etc) like etc, etc. Eclipse reports an error like "unresolved inclusion xxx" because there are too much candidates of those files. Can eclipse analysis makefile and select the correct path like compiler if I specify a variable or identifier to notify eclipse just like a makefile option?
Can anyone help me, please?
Thanks,
-Yunfei
For your driver work checkout:
http://wiki.eclipse.org/HowTo_use_the_CDT_to_navigate_Linux_kernel_source
In general when working with a Makefile project you need to give Eclipse a hand so it knows where to find the includes and which preprocessor symbols are defined.
Right click on your project. Select properties -> C/C++ General -> Path and symbols.
Add the most important include paths and the indexer results will become much better.
So there has been an overhaul of the scanner discovery as worked on here:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=290631
http://dev.eclipse.org/mhonarc/lists/cdt-dev/msg24345.html
However, I can't find any information on how to use it. I upgraded from Helios to Juno recently and now I have 8000 "Semantic Errors" and a ton of unresolved includes. However, I can't figure out how to use this new feature. I don't think there's any documentation yet, either.
I think the intent is it will scan your project and automatically discover macros and include directories in order to aid in symbol resolution and project navigation.
I'll keep working on it and update this question if I ever figure it out.
Figured it out.
Used this as a guide: https://developer.mozilla.org/en/Eclipse_CDT
In the project properties, "C/C++ Build", I replaced the default build command with my build command. I had to remove a -s switch (silent switch) so the output parser could grab all the paths and macros from the compiler commands. Pointed the "build directory" to the directory with my makefile.
Under "C/C++ General" > "Preprocessor Include Paths, Macros etc." > "Providers" I selected CDT User Setting Entries and CDT GCC Build Output Parser. I then had to change the compiler command pattern to match my gcc cross compiler. To do that, I just changed "gcc" to "arm-elf-gcc".
After a full build (do not use multi-core builds for the first indexing), right click your project, click 'index' and 'rebuild'. After this, the output parser populated the indexes correctly and they showed up under "C/C++ General" > "Preprocessor Include Paths, Macros etc." > "Entries"