blob: 979758d6d3182f2092215a6c244e0904a3fec1e9 [file] [log] [blame]
<html>
<head>
<title>Include files for Synchronized Projects</title>
<link rel="stylesheet" type="text/css" href="help.css">
<script type="text/javascript" src="thumb.js"> </script>
</head>
<body>
<h1 id="top">Include files for Synchronized Projects</h1>
<p>There are several places where include files are important
to the editing, analyzing, building, and running of your program.
A <a href="sync.html">Synchronized Project</a> mirrors the source files on the local machine as well as the
remote target machine. Usually you edit locally, but build and run on the remote target.
So this complicates things with respect to include files.
<ul>
<li><b>Local:</b> Eclipse can use include files to provide information about
APIs in the editor, via hover-help, for example. Macro definitions also can be established via include files.
The header files within your project are synchronized to the local machine and will be found by Eclipse.
Having correct include files available (for system and library includes) can prevent
<a href="PLUGINS_ROOT/org.eclipse.ptp.pldt.doc.user/html/codan.html">Codan</a> (C/C++ Code Analysis in CDT)
from flagging potential errors incorrectly.
(Codan analysis can also be turned off if this is preferable. See above link.)
<li><b>Build:</b> the remote system will use its own paths, environment management, etc
for this. The Eclipse settings don't matter for this.
</li></ul>
<p>Your local environment (where Eclipse is installed) may not have the same set of system and library include
files that your program should be built with.
So you may want to tell Eclipse where the remote files are.
<ul><li>There's nothing wrong with having your eclipse project <b>Paths and Symbols</b> point
at local include paths for system and library include files so that hover help, Codan, etc., will resolve to something
useful. These aren't used for the build, just to assist with Eclipse tools.
</li></ul>
<p><b>Note:</b> In the past, other mechanisms in the project properties have worked to set remote include paths for CDT
that worked with Synchronized projects.
(There are several places that <b>Paths and Symbols</b> can be set.)
At the moment (Kepler release, PTP 7.0, June 2013) the following seems to work.
<ul>
<li>Bring up <a href="misc.html#projProps">Project Properties</a> for the project (right-mouse on project in <b>Project Explorer</b>
and select <b>Properties</b> at the bottom of the context menu).
<p>&nbsp;
<li>In the Properties dialog, select <b>Paths and Symbols</b> on the left side.
<p><img src="images/includePaths1.png"></p>
<p>&nbsp;
<li>Make sure that the active configuration is selected at the top,
that the <b>Includes</b> sub-tab is selected
and that your C compiler is selected on the left side under <b>Languages</b>.
Select the <b>Add...</b> button to add an include path.
<p>In the <b>Add directory path</b> dialog, you will enter a UNC-style path, using the
<a href="remoteTools.html#create">Remote Connection</a> target name as the prefix, of the form:
<code>//connection-name/path/to/includes</code>
<p><img src="images/includePaths2.png"></p>
<p>&nbsp;
<p>Enter the path, prefixed by the remote connection target name.
Add other paths if desired.
Select the <b>OK</b> button in the <b>Add</b> dialog. You will see the list of include paths you added in the list under <b>Include directories</b>.
<p><img src="images/includePaths6.png"></p>
<p>&nbsp;
<li>Select the <b>OK</b> button in the <b>Properties</b> dialog to close Project Properties.
<p>&nbsp;
<li>You will see a <b>Paths and Symbols</b> dialog asking you to rebuild the index with these new include files.
Select <b>Yes</b> to continue.
<p><img src="images/includePaths4-rebuildIndex.png"></p>
<p>&nbsp;
<p>The indexer make take a few minutes to run, depending on the size of your program and the connection speed.
You can watch its progress in the status area in the lower right hand corner of the Eclipse workbench.
<p><img src="images/includePaths7-indexer.png"></p>
<p>&nbsp;
<li>Now, if you have added include files for all the APIs used in a file, then when you edit the file,
the <a href="PLUGINS_ROOT/org.eclipse.ptp.pldt.doc.user/html/codan.html">Codan</a> errors will be gone.
If you hyperlink-click (ctrl-click) on an include file name in the editor, or on an API name,
the editor will open on that (remote) include file.
You can hover over the editor tab of this file to see that it is indeed located, via the remote tools connection,
on the remote system.
<p><img src="images/includePaths5-hoverEditorTab.png"></p>
<p>&nbsp;
</ul>
<p>
<p>&nbsp;
<p>&nbsp;
<p><a href="#top">Back to Top</a> | <a href="toc.html">Back to Table of Contents</a>
</body>
</html>