"Export" button in Eclipse CDT "Paths and Symbols" dialog? - eclipse

On the Includes tab of the Paths and Symbols section of the Project Properties dialog in the Eclipse CDT, there is an "Export" button:
The best documentation I have found says that this "toggles whether the selected include path is exported or not." If I click it, it changes to "Unexport" and "[exp]" is appended to the selected include path.
What exactly does this do? What does it mean to "export an include path?"

This button makes the path in question available to projects which reference your current project. Project references can be configured using the References tab in the same "Paths and Symbols" group shown in your screenshot.
This functionality has been improved in the next version of CDT (7.x). It allows you to create dependencies between projects and have include, library and library files being propagated automatically. (In the next version you can alter the order of the referenced projects...)
See also the Export Settings page which can be enabled with
Window > Preferences > C/C++ >
Property Page Settings > Display
"Export Settings" Tab

Related

Eclipse: Error "Variable references empty selection: ${resource_loc}"

I have found that using the Eclipse "external tools" launch configuration is the best way to open my favorite editor on the current file in Eclipse, notably offering a one-time and super-flexible configuration versus the "Open With" menu, which I had tried to use beforehand and always found wanting, constraining, limiting, and requiring repetitive work for many file types. I set up this external tool as follows and this works great for files in my project:
Run:External Tools:External Tools Configurations...
New launch configuration
On the "Build" tab, un-check "Build before Launch"
On the Common tab, check "External Tools" under the "Display in favorites menu"
On the Main tab, enter "/usr/bin/myeditor" for the Location
Under "Working Directory" I am able to leave this blank
Under arguments ${resource_loc}
(At the top, in the "Name" field whatever I want the name to show up as)
I originally found this general technique for launching an external editor right here on stackoverflow.
So you can see ${resource_loc} or ${resource_path} is the one and only variable I need for this to work, and it does work great when I open a file located inside my Eclipse project and click the external tool. That part is fine.
But the problem I have just discovered occurs when I open a file that is not specifically listed in my project and then click the external tool button. It no longer works and I get an error dialog saying: "Variable references empty selection: ${resource_loc}."
Specifically, to reproduce this, I can create a new C++ "Hello World" project (CDT is included in my Eclipse along with Java) then add the line #include "/tmp/whatever.h" at the top of the one cpp file in the project and then right-click on "/tmp/whatever.h" and use the command "Open Declaration" and Eclipse kindly opens the file /tmp/whatever.h. Finally, I invoke my external tool intending to view whatever.h in my editor, and bang, that's when the problem occurs. (Before doing this I put a harmless line of commented text into /tmp/whatever.h.)
Before some SOer asks, no I am not actually trying to #include "/tmp/whatever.h". I am using this #include example as a specific way to show how the error can be reproduced. If you must know, in my case I actually observed the error when trying to open the editor while using Eclipse to browse framework files, files that are not part of my project.
I have already tried ${resource_path} to see if maybe that might have something in it in this context, but same error, and I have looked at the documented list of Eclipse launch variables here and again I don't see anything that looks like it would be more well-defined in the context of a file that is not part of the current project.
My assessment right now is that this is an unsolvable problem and likely just a limitation of trying to use the "External Tools" for this editor launching business. I only settled on that after using the default "Open With" menu in Eclipse for a while and finding the whole setup there highly unsatisfactory and requiring repeated configuration and actually IIRC it just would not work at all I believe in the context of my editor and controlling how many windows are created, whether one or many or one per project etc. Above, I simplified the launch for demonstration purposes.
OS: GNU/Linux Xubuntu 15.10.
Eclipse: Mars.1 Release (4.5.1) Build id: 20150924-1200
You can circumvent the "Workspace is the top-most Eclipse place" rule by linking files (or folders for that matter) in a project.
Example:
Create a new project:
File → New → Project → General → Project → Next → Project name: LinkProject → Finish
Create a file outside-workspace anywhere outside your Eclipse workspace dir.
Import this file as link:
Select LinkProject → File → Import... → General → File System → Next > → From directory: <as chosen for the file above> → Check ☑️ 📄 outside-workspace→ (⚠️ The next can be overlooked easily!) Advanced >> → Check ☑️ Create links in workspace → Finish
NB: I doesn't matter whether you uncheck  ☐ Create link locations relative to: PROJECT_LOC     ˅  or what you select from the list. ${resource_loc} is always the same. Just the file's/folder's Properties → Location: changes. There is a new property for linked files/folders: Resolved location which shows what ${resource_loc} is resolved to: an FQFN.
And, once you linked a file/folder in your project it is part of your project and you can also access it relatively, e.g. with ${workspace_loc:/LinkProject/outside-workspace}' which resolves to the FQFN, too.
See also Eclipse Platform User Guide – Linked resources.

Eclipse does not remember external source attachments

Using Eclipse 4.3.1 (Kepler) on Ubuntu, I find that each time I exit and reenter Eclipse, I have to respecify my external source attachments. What is the key to making Eclipse remember them?
Open the Source Attachment Configuration dialog by clicking on the "Change Attached Source" button in the Class File Editor; or open the similar Java Source Attachment dialog by right-clicking on the containing jar in Package Explorer and selecting "Properties".
I've tried both.
In the dialog, click on the "External File" button and navigate to a jar containing sources, or click on the "External Folder" button and navigate to a directory containing .java files in subdirectories corresponding to the package hierarchy.
All these ways work until I quit Eclipse and come back in.
I have never used these parts of Eclipse; I'm using Maven to manage my dependencies and Maven will automatically attach sources - so take my answer with a grain of salt :-)
I'm not sure why Eclipse doesn't remember those settings. My current feeling is that those settings are temporary.
If you edit the source attachments in the project's properties (look for "Java Build Path"; there is a tab "Libraries"), then the changes should be saved in the file .classpath. Have a look in there.
Lastly, you can try to create a "User Library" (search for this term in the preferences dialog). Here, you can define a bundle of JARs which make up some library. After adding the code JAR, you get options to specify the source JAR.

How to link to cublas library in eclipse Nsight?

I am using Nvidia's example code for simpleCUBLAS. The example comes with a Makefile, or I can compile it like this:
g++ -m32 -I/usr/local/cuda/include -I. -o simpleCUBLAS.o -c simpleCUBLAS.cc
g++ -m32 -o simpleCUBLAS simpleCUBLAS.o -L/usr/local/cuda/lib -l cudart -l cublas
(the files included by the "-I." are cuda_runtime.h helper_cuda.h helper_string.h)
This compiles and runs just fine.
However, I would like to make this using Eclipse's Nsight editor for CUDA.
My Question is:
How to I add these options to Eclipse (the -L/usr/local/cuda/lib -l cudart -l cublas, & the -I.) Nsight?
Other details:
Am using Linux.
I've seen some info elsewhere for Eclipse & c/c++ Project, BUT here I am using cuda c/c++ Project.
Thanks.
I don't think any of this is specific to Nsight Eclipse Edition. What you are trying to do are standard operations for any C/C++ project built using Eclipse. Nsight EE doesn't change these steps in any major way. You can get help easily enough on these topics using the built-in Eclipse help in Nsight EE. For example:
open help (select help...help contents)
in the search box type "add library"
click on the first item returned in the help search pane
All of your questions (adding library paths, adding libraries, adding include paths) have to do with the Project Properties. We can access these properties directly by:
Open the project in Nsight EE
In the project pane on the left, right-click on the project whose properties you wish to inspect/modify, then select "Properties" from the pop-up menu (the last item in the menu)
The project properties pane is now open.
Click on the triangle next to "General" in the properties dialog. This will open the "General" sub-menu.
Under General, click on "Paths and Symbols" The generic Eclipse help would have taken you this far.
Now click on "CUDA C" (Yes this is the one step that is different.)
The tabs across the top now include selections for things like "Includes", Libraries", "Library Paths" etc. By selecting any one of these tabs, you can add or modify the appropriate entries.
So as one example, let's add the cublas library. Select the "Libraries" tab.
Now click the "Add" button
Enter the name of the library. It is cublas, not lcublas, and not -lcublas
now click "OK", "Apply" and exit out of the properties, build your project, and confirm that -lcublas has been added to the build command

Hadoop Documentation for Eclipse

I recently installed Hadoop and am able to run simple programs.
However I would like to view documentation for Hadoop classes within Javadoc browser in Eclipse.
Please let me know how to enable that (I am a little novice with Eclipse IDE).
Thanks.
A couple of suggestions:
If you're using maven for your dependency management, you should be able to expand out the list of Maven dependencies in your Eclipse project, right click the hadoop-core-x.x.x.jar and select Maven -> Download Javadocs
Otherwise you'll need to source the Javadocs from the $HADOOP_HOME/docs/api folder and associated with your hadoop-core-x.x.x.jar in Eclipse. In Eclipse, right click your Java project and select Build Path -> Configure Build Path. Now click the Libraries tab and locate the entry for hadoop-core-x.x.x.jar. Expand the entry to show options for Source, Javadoc etc locations and click the Javadoc location entry. Now click the Edit button to the right and enter the location as the path $HADOOP_HOME/docs/api in the Javadoc URL text box (mine is file:/opt/hadoop/hadoop-1.0.2/docs/api/)
Either way now you should be able to hover over Hadoop classes in Eclipse and the Javadoc will popup. You can also show the Javadoc window that will populate for the class you are currently viewing, or just open an internal browser window and point it at the $HADOOP_HOME/docs/api/index.html file
Another easy solution for those who want to stay updated is to edit the Javadocs path like Chris said:
"In Eclipse, right click your Java project and select Build Path -> Configure Build Path. Now click the Libraries tab and locate the entry for hadoop-core-x.x.x.jar. Expand the entry to show options for Source, Javadoc etc locations and click the Javadoc location entry. Now click the Edit button to the right and enter the location as the path"
but instead of linking it directly to the api you have stored on your hard disk, link it to http://hadoop.apache.org/docs/stable/api/

How to use eclox, the doxygen plugin for Eclipse

How do I get eclox working in Eclipse 3.5?
I'm using Ubuntu 9.04. I installed Doxygen from ubuntu repositories(version 1.5.8). Then I installed eclox on eclipse through the update site.
Despite this, I don't get any option to in any menu to initiate it.
Also the eclox site doesn't seem to have any "getting started" guide.
Please help.
BTW there is a manual inside org.gna.eclox_0.8.0.jar, wierd they did not post this on the project site!!!
Here is the content
Eclox, a Doxygen frontend plugin for Eclipse.
<http://gna.org/projects/eclox>
INSTALLATION
There are two options to install the plugin: using the update site or
using the packaged feature.
The update site is the more convenient way to install eclox. It is
located at https://anb0s.github.io/eclox. See eclipse's user
guilde for additionnal details.
When using the packaged feature, you must extract the archive content into
your eclipse's root location. For additionnal details, please refer to
eclipse's user guide.
CONFIGURATION
Once the plugin installed, you must ensure that the default PATH environment
variable makes the doxygen binary reachable for the plugin. If not, you can
update PATH to include to directory containing the Doxygen binary, or you can
tell Eclox where that binary is located on your system (which is in my opinion
the better solution). To do this, open eclipse's preference edition dialog
window and go into the new "Doxygen" section.
USAGE
You can create new Doxygen projects (also called doxyfiles) using the
creation wizard. Go to "File->New->Other->Other->Doxygen Configuration". Press
next and set both file location and name. Then a empty doxyfile will be
created at the specified location, the wizard automatically adds the
".Doxyfile" extension.
You should now see a file with a blue #-sign icon. This is your new
doxyfile. Double-clicking on it will open the editor. You can now browse and
edit the settings.
Once your have properly set all doxyfile fields, you can launch a
documentation build using the toolbar icon showing a blue #-sign. In
the case the button is not visible in the toolbar, your current perspective
needs to get configured. Go to "Window->Customize perspective->Commands" and
in "Available command groups" check "Doxygen". Additionnaly, you can browse
the laetest builds by clicking the down arrow right to the toolbar button.
When the documentation build starts, a new view showing the build log opens.
In its toolbar, a button named "Stop" allows you to halt the current build
process. The current build also appears in the Eclipse job progress view and
you can control the job from there.
The build toolbar action determine the next doxyfile to build depending on
the current active workbench part (editor or view) and the current selection
in that part. For example, if the active part is a doxyfile editor, the next
doxyfile to build will be the one being edited. If the active part is the
resource explorer and the current selection is a doxyfile, that doxyfile will
be next to get build. In the case the active part selection doesn't correspond
to a doxyfile, the last built doxyfile will be rebuiled. And if the build
history is empty, you will be asked for the doxyfile to build.
HTH Anybody
Never mind, worked it out my self.
First you need to create a DoxyFile (which is the configuration file) by giving the source path and the output path.
Then only you can generate the documentation by right clicking the project and selecting the "Generate Documentation".
Thanks anyway!
I just faced a problem setting the Doxygen binary path in eclox 0.8.0 settings in Eclipse on Mac OS X 10.7.
There is no way to configure the path via Eclipse-preferences->Doxygen.
The solution is to edit the preferences file manually
add a (fake) location, let's say /Applications, using the wizard mentioned above.
close Eclipse
edit this file:
$WORKSPACE/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.gna.eclox.core.prefs:
Replace the value for doxygen.default (currently eclox.core.doxygen.CustomDoxygen /Applications\n) with eclox.core.doxygen.CustomDoxygen /Applications/Doxygen.app/Contents/Resources/doxygen\n.
restart Eclipse
For MacOS user there is a very easy way to get around via the issue of the Doxygen version selection. The link that provides details is here:https://github.com/theolind/mahm3lib/wiki/Integrating-Doxygen-with-Eclipse
After installing the Eclox plugging:
1)"go to "Eclipse --> Preferences --> Oxygen"
2)"Press Shift+CMD+G then Add: "/Applications/Doxygen.app/Contents/Resources/doxygen"
3) Doxygen's version should be displayed
this might help you or any windows user trying to install eclox:
Tutorial for Installing eclox — Document Transcript
Step 1: go to eclox website (http://home.gna.org/eclox/) and to copy the update link address.Step
step 2: Insert the link into the update manager in eclipse and press OK.
Step 3: Select the Eclox item and to complete the installation.
Step 4: When the installation has done, you should select a project that you want to generate thedoxygen documents. Then, create a doxygen project for it.
Step 5: config the options. Note: You have to provide the “Input directories” correctly and to select the “Scan recursively”item. Finally, save the configuration file.
Step 6: find out the “#” and to choice “Choose Doxyfile...”.
Step 7: select a doxyfile.Step 8: wait for few seconds and the doucments will be generated.
its from this link: http://www.slideshare.net/pickerweng/tutorial-for-installing-eclox
Like claus I had to dig into the preferences file maually, because eclox 0.8.0 would just not take a good path from Eclipse Preferences file chooser.
So, edit this file: $WORKSPACE/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.gna.eclox.core.prefs and alter the given path (in my case I had to change from
doxygen.default=eclox.core.doxygen.CustomDoxygen C\:\\Programm Files\\doxygen\\bin
to this
doxygen.default=eclox.core.doxygen.CustomDoxygen C\:\\Programme\\doxygen\\bin
Hope this helps.
I find a webpage https://github.com/theolind/mahm3lib/wiki/Integrating-Doxygen-with-Eclipse where you can find more details. Especially, for Mac users, you need to Press Shift+CMD+G then Add: "/Applications/Doxygen.app/Contents/Resources/doxygen" when you configure the doxygen in eclipse before compiling .doxygfile by using Eclox.
Alternative from eclipse is to use Javadoc:
From menu (...Search Project Run...)
Project > Generate Javadoc
You should be in Java project and add comments with tags.
!!!