How do add include path to Eclipse project (C++, open folder mode) - c++

I created a project by opening an already existing folder. There are some include files I need to add, otherwise Eclipse won't find references. If I right-click on the folder, I don't see the usual option I would see with a regular project. Is there a way to tell Eclipse where to look for w.r.t. include files?

What do you see then if you do not see the usual option? There is also a way to set paths in eclipse preferences, not just the project preferences. Did you try it?

Related

What is the C++ Source Directories project property good for in Visual Studio? [duplicate]

Sorry for the basic question but I can't find an answer that works.
I have VS 2017 Professional 15.6.6
I just want to add source files to Intellisense's database, so that when I e.g. right-click on a symbol and choose "Go To Definition" the appropriate source will open in the editor.
The source in question is in a static .lib that I am linking with my .exe Project.
If I add the source as another Project in the same solution as my .exe project, Intellisense picks it up (whether or not I actually build the Project with the source). But I would like to just add a directory to what Intellisense sees without changing my Solution.
I tried adding the directory to Project --> Properties --> VC++ Directories --> Source Directories. That did not work. What is the purpose of this "Source Directories" setting?
I tried adding the directory to Solution --> Properties --> Debug Source Files. That also did not work. What is the purpose of this "Debug Source Files" setting?
I've done it by adding the source to the solution but disable the project from being compiled. I'm sure there is a better solution for this. I hope that someone else have found it and want to share it with us.

Eclipse C++ in Clearcase vobs: Unresolved inclusion

I would like to get your thoughts on why I am getting an "unresolved inclusion" error for certain .h files included as part of my project.
I actually cloned the project from another existing project, by simply copying, pasting and renaming.
Inside the cloned project, which originally had only a src/ directory, I also created a tst/ directory and did right-click->New->Folder and from the menu, clicked on Advanced >> and selected "Link to alternate location (Linked Folder)" and browsed to the relevant path under /vobs to add the source folder to my project.
Once I did this, the indexer started rebuilding the index, at the end of which I got the above mentioned inclusion errors.
The .h files could be located inside a specific folder path under /vobs; I first tried including this path by right-clicking on the cloned project and choosing Properties->Paths and Symbols->Includes to update the include list with the folder path. This didn't resolve the error.
Subsequently, I tried repeating the above procedure for the newly created tst/ directory from within the project; that didn't resolve the error either.
Not sure what is it that I am missing here.
Any suggestions would be appreciated.
Check first if those files are there, in your view. '/vob' could mean dynamic view, mounted under /vob.
I would rather work with a snashot view, which would download those same files on disk (rather than using the MVFS, Multi-Version FileSystem of a dynamic view).
Then, when you are sure the files are there, and cleartool ls shows them correctly loaded, you can double-check your inclusion paths, as mentioned here
"unresolved inclusion" means the file can't be found.
This means the directory containing it hasn't been specified to CDT or it has been misspelled.
If spelled correctly, normally you would specify the path with Project --> Properties --> C/C++ General --> Preprocessor Include Paths, Macros etc. on the Entries tab as a user entry.
Note that it depends on the type of project.
When you select File --> New -> C/C++ Project you are presented with various options.
The options are for the kind of builder used.
Some, such as Meson, Qt , Arduino and maybe others don't have the option "Preprocessor" option.
My guess is that you are not set in a view when you start Eclipse. This will prevent resolution of the the absolute "/vobs/..." paths. If you start Eclipse from GNOME (or any other windowed environment) the current working directory of Eclipse is likely your home directory. Without a view context, the /vobs/... paths will not contain any files under source control.
You COULD use /view/myview/vobs/myvob/... in the include paths, but that would mean EVERYONE who would use the project would have to either start your view or create and start an identically named one... And that's just the start of that particular can of worms.
You may want to confirm how Eclipse handles relative paths in the include path. Do they start from the current working directory of Eclipse? The project home directory? Somewhere else? That may give you a safe view-independent way to specify your include paths.
I would try setting a view and starting Eclipse from within the subshell spawned by cleartool setview. Then verify whether the includes are accessible.

Unnecessary imports in Eclipse CDT

I converted from GCC 3.4.2 to 4.8.1 but my projects in Eclipse still leave the imports, and those imports also show as warnings in the source code. I can't find any way to remove them manually and those folders don't exist on the filesystem. How do I fix this?
Here is an illustration: http://i.imgur.com/dSejoWs.jpg
Goto Project 'Properties->C++ General->Path & Symbols Includes' Tab and remove those path entries there, respectively change them to your new installation paths.
Another place to look might be 'Properties->C++ General->Preprocessor Include Pathes', if there are project specific entries for these pathes.
I fixed it by deleting the .metadata folder in the workspace directory and reimporting the project. I had to reconfigure Eclipse but at least it works now. Thanks for the suggestions.

Include C++ library source in Netbeans project?

Is there a "good" way to directly include a library's source in a Netbeans project?
When I try to do it, I add the include directory in the Linker options and src in the source directories but I get a ton of "undefined reference" errors unless I add the folder into the project using right click>add existing items from folder.
Is there a better way to do this without having all the the code in the project ?
Thanks a lot in advance for your answers
Try doing this:
Select Tools->Libraries from the menu, create a new library there, then on right side click "add Jar/folder" to insert your folder.

setup include path in eclipse CDT in mac os (headers from framework)

for example I need to include a header
#include <OpenGL/glext.h>
while it is actually a header file glext.h under OpenGL.framework/Headers/.
Therefore it is no way to give eclipse a physical path about "OpenGL/glext.h", and I always get unresolved inclusion warning.
I can still build and run them (with managed makefile project) but it is impossible to browse the functions or definitions from those "resolved" header files.
is there any solution?
While not ideal, my solution to this has been to create a folder "/Developer/Framework Headers" (though the name isn't important), and link from e.g. "/System/Library/Frameworks/Foo.framework/Headers" to "Foo" under said folder. Then in Eclipse I add "/Developer/Framework Headers" to a project's includes.
I say not ideal because apart from having to create links for the frameworks you need and add an include to each project, Eclipse seems to have trouble in certain cases such as nested frameworks (e.g. CoreGraphics beneath ApplicationServices), but YMMV.
Yes there is one. Right click on the project in "Project Explore" window and click on the "property". In there Open "C/C++ General" column and choose "Path and symbols". Now you see all of the include library path for this project. If your using C then add the OpenGL library into GNU C, or if you use C++ then add it into GNU C++. Unfortunately you have to do this for every new project. I have been searching for a while how to do this by default but nothing really useful. Hope this help you get rid of those annoying yellow wave lines.
Since current Eclipse CDT releases don't perform sub-framework header inclusion correctly, you can avoid sub-framework problems (like those generated by the CoreServices header files) by creating symbolic links to the include directories of each sub-framework. I elaborated on this subject, which stems from danhan answer on this question, in this blog post.
In order to automate this process, I've created a Z shell script which automates this process and creates the symlink to the specified frameworks' header directory, together with the links to the include directory of each one of their sub-frameworks. The script can be found in this GitHub repository.
Hope this helps.