I have a project requirement so that CDT things peacefully co-exist with other tools from other CDT like vendors. To that end, I have this directory structure:
+(root)
|->libfoo/src, and libfoo/include <- the foo package
|->libbar/src, and libbar/include <- the bar package.
|->application/src -< the application lives here.
|->keil <-- all things KEIL ide go here
|->xilinx <- "vivado/vitus(eclipe) '.project/.cproject' need to go here.
|->microsemiCM3 <- microsemisoft console '.project/.cproject' need to go here.
|->microsemiRisdV <- microsemisoft console '.project/.cproject' need to go here.
|->stm32cube <- STM32 ".project/.cproject" go here.
In addition to the above, a "main.c" file exists in each of the "tool directories, ie: there is a "main.c" file for keil, another for xilinx and another for microsemi, etc. This deals with the specifics of that compiler.
My goal is to add the source folders: ../libfoo/src and ../libbar/src to each of the eclipse based projects. These contain common code to all compilers, generally they are like a library but we compile them in as source code instead.
I create a project and select PROPERIES, "C/C++ General? and select PATH and SYMBOLS. I select SOURCE Location and I want to add two new source folders (see above). The problem is - the IDE demands these projects are part of and live in/under the directory where the .project file is located.
Suggestions?
Related
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!
There are a couple of folders in different locations on my hard drive that contain resources I use a lot while coding (documentation, links, ...) but aren't really related to any specific one of my projects.
How can I have the Eclipse Package Explorer show such a folder that is not inside one of my existing projects?
One potential use: Quick way to transfer "External Tool Configurations" from one Eclipse install to another? (see comments to accepted answer...)
Since everything that the Package Explorer shows has to be in a project (as pointed out by #greg-449), one needs to create a dummy-project in the required location:
Go to: File ⇒ New ⇒ Project... ⇒ General ⇒ Project
Pick a Project name
Uncheck Use default location
Browse... for the folder to show
Click Finish
Minor cosmetic issue: Eclipse will save a .project file in that folder...
Aside:
To make this folder appear at the top of the list, one can give it a name like _Documentation_ as Eclipse sorts the underscore before any letters.
I'm new to Eclipse, having done a lot of development in Visual Studio and XCode.
When I create a C++ project in my source tree the project explorer shows all the files in that folder and sub-folders. However there are lots of unrelated files that I don't want to see.
In Visual Studio and XCode I have to manually link source code to the project. This allows me to control the clutter of the project. Non-project files are "hidden" by default, because they aren't added to the project. In Eclipse everything is added by default. It seems that you can't decouple the file system's storage from the view you see in the project explorer.
Also I have a bunch of source in my tree that I don't want to compile as part of this project. Because it's for a different platform. I can't see how to remove these files from the compile list without also removing them from the file system.
Reading the docs hasn't helped much. What am I missing here?
There are 2 parts to this solution. First file name filters can be defined as described in this post:
Eclipse: how to hide custom files in Project Explorer
2nd the remaining files that I don't want compiled can be excluded by right clicking on them and Properties -> C++ build -> Exclude resource from build.
So it's more a negative space thing. In traditional systems, you have to explicitly add code to the project. In Eclipse you have to explicitly REMOVE code from the project. I prefer the old way because sometimes you want to include code from disparate regions on the disk and that just makes the all inclusive model of eclipse break. But I guess I'll cross that bridge when I get to it. sigh
I'm having trouble getting Eclipse to index my source code. I'm using Eclipse Helios on Windows XP at the moment.
I have a directory called src. Within it, I have a bunch of dirs, something like this:
src
-include (common headers)
-lib
-libIO (source code for this library)
-libGUI (source code for this library)
-pgms
-pgm1 (source code and headers for this pgm)
-pgm2 (source code and headers for this pgm)
Each leaf has its own Makefile. There is no top-level Makefile in src. pgm1 can and does include files from include and lib/libIO and lib/libGUI.
Basically, I want Eclipse to index my entire src directory, without having to set up a C/C++ project for every leaf in my tree. I can't seem to find a way to make this happen.
Here's my symptoms; what I'm trying to solve for:
When editing source in the pgm1 dir, it references functions that are declared in my include dir header files and defined in source files found in lib/libIO.
However, when I press F3 to get to the declaration of a function, Eclipse says "Could not find symbol 'X' in index". I can't seem to get Eclipse to find either the header declaration or the source definition for the method under my cursor (like the Java module does perfectly). Is this possible?
I had exactly same issue as OP but for some reason the menus in Eclipse I was using (Helios Service Release 2) were not "Go to Properties -> C/C++ General -> Paths and Symbols -> Source Location.".
The way I fixed the issue was :
in C/C++ view, right-click on top project name;
in the menu, select New->C++ Project;
in the window that appears, select Convert to and then select C++ project;
click OK to close the window.
Eclipse will start indexing right away. Depending on the size of source tree it may take a while but you will have the indexing working finally after that.
I faced similar situation. I solved it in this way: right-click the project in project View-->select Index-->rebuild.
I managed to solve this thanks to comments here.... I ended up recreating my project. I used the Import method to download a project from CVS, and told it to use the New Project wizard to do so. When I got the New Project dialog, I told it this was a C++ Project, and the indexing now works fine.
I still wish I could index files without having to attach a specific project type to it, but at least I found an answer.
Thanks for the help all.
Exit Eclipse. In workspace go to ".metadata/.plugins/org.eclipse.cdt.core" and delete everything in there.
in the project explorer panel, right click the project you want to re-index, then select index, then select the action you want
Indexing of files and variables under different flags is always complicated when we have a huge project, lot of files and more importantly lot of different build options. I prefer playing around with the Indexer option to help me browse the entire code.
You can find it : Project Properties>C/C++ General/Indexer.
You can choose "Enable project specific settings"
Then it's up to you to choose the options you want for your project.
For a particular build we can choose "Use active build configuration" so that only the files and MACROS are considered which are used by the build script.
Or Index all source files in the entire project.
I am using Eclipse Neon 3, here's the solution that worked for me :
go to File
New
Convert to C/C++ Autotools project
then select your project and finish.
It can take some time to finish indexing, it depends on your project size.
I have experienced problems with the indexer of Eclipse Luna when there was an unresolved friend declaration in the class declaration - it seems then that the indexer skipped indexing the rest of that class, and all references to it was shown as unresolved by the indexer.
Solution: removed the unresolved friend declaration (in my case, it was legacy code that was no longer needed).
Please try the following (my project is set up differently, so I am not sure this will work for you).
Go to Properties -> C/C++ General -> Paths and Symbols -> Source Location.
Do you see your source folder there?
I observe this behavior:
When I add a source folder and then exclude it from build, it disappears from the above list. After that the folder is no longer indexed. Re-adding it to "Source Location" solves the problem: the folder is now indexed; remains excluded from build (as intended); is visible among source locations.
I believe it is a bug -- excluding a source folder from build should not remove it from source locations list.
In Coocox IDE (Eclipse + gcc) the problem is resolved by going from file menu
Edit > Preferences > C/C++ / Indexer > Build configuration for Indexer set to Active build configuration and the rebuild the project (Ctrl R).
If the project is already converted to C/C++ and still the index is not working you can right click on the project and Index and rebuild. The project will start indexing right away.
I am using
Eclipse IDE for C/C++ Linux Developers
Version: Helios Service Release 2
Build id: 20110218-0911
I followed the suggestions above and in addition I had to mark all referenced projects (with in the work space) using project properties->Project references
The following has worked for me in Eclipse Neon:
New Project -> C/C++ -> Makefile project with existing code -> Next. Then Navigate to the code and finish the project creation. Indexing starts automatically.
how to create a general project only containing one folder in netbeans 6.9? In eclipse i can do it, but in netbeans sometime i just want to organize some files related to some category, so i want to create a single project just only containing folder and files, but now it seems that it's not possible.
if someone has the same problem, and can share your experience, thank u.
When I need to have access to a collection of files located in a folder or group of sub-folders, and I don't need much IDE support, then I add the top-level folder to the "Favorites" tab. From there I can open any file in an editor, and perform other file system commands that NetBeans makes available. If you are using a version control system supported by NetBeans with that collection of files, then those commands should be available to you too. What is not available are things like "Build" and "Debug", etc. (obviously).
If you cannot see the "Favorites" tab (it would be in with "Projects", "Files", "Services", etc.), then open the Window menu and click on Favorites.
As #lepe suggests, if your files all tend to be of a particular type, then you can create a project of that type, and then have access to the files on the "Projects" tab. Just ignore the "extra" stuff that NetBeans is giving you.
Finally, "Freeform" project types exist for certain types of projects, and Java also has an "Automatic" project type (if you install the appropriate plugin from the Update Center). These types of projects more closely resemble NetBeans-generated projects insofar as they are designed to be used with existing Ant build.xml scripts and whatnot (Automatic projects are a bit looser on that), but they still assume that the project is intended for builds, etc.
If you have a "generic" project that uses Ant to "do stuff" kind of like a build, then you might be able to subvert one of the "Freeform" project types, cajoling it into what you need.
In the end, I find just having the folder in "Favorites" works the best for me when I don't need all the extra stuff.
The benefit of Projects as opposed to Favorites is that each project remembers the files you had open when you last switched away from that project.
I use NetBeans just for editing web stuff (HTML, CSS and JavaScript files) within the context of a larger Java project (for which I use Eclipse). I use the PHP version of NetBeans, since it's the most light weight version that handles these web resources. To create a new NetBeans project for my existing Java web app I do: File > New Project > PHP > PHP Application with Existing Sources. On the next wizard screen, in "Sources Folder" browse for the folder that is the parent of all your web stuff (e.g. src/main/webapp). Leave all the other fields with their default values, just to humour NetBeans that we're dealing with a PHP project. Click Finish. No PHP specific stuff gets created. A "nbproject" folder is the only thing that gets created in your chosen folder. (There is the option of locating this outside of the project but I find it convenient to have it located with the project itself, and I just configure my source control system to ignore this folder.)