| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| <html> |
| <head> |
| <title>C/C++ Application How-Tos</title> |
| <link rel="stylesheet" href="https://netbeans.org/netbeans.css" type="text/css"> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" > |
| <meta name="description" |
| content="Configuring code assistance for a multi-platform project"> |
| <meta name="author" content="Vladimir Kvashin and Vladimir Voskresensky"> <!--Optional tag--> |
| <meta name="keywords" content=""> <!--Useful for including potential alternate search terms (shouldn't |
| overlap with words that are prominently listed in the tutorial) --> |
| |
| |
| </head> |
| <body> |
| <a name="top"></a> |
| |
| <h1>C/C++ Application How-Tos</h1> |
| <!-- START INTRO ---------------------------------------------------------------------------------------* --> |
| <div class="articledate" style="margin-left: 0px;font-style:italic;"> |
| <p><em>Contributed by <a |
| href="mailto:vladimir.kvashin@sun.com"><i>Vladimir Kvashin</i></a> and <a |
| href="mailto:vladimir.voskresensky.com"><i>Vladimir Voskresensky</i></a><br> |
| and maintained by <i>Susan Morgan</i> |
| |
| December 2009</em> [Revision number: V6.8-1] |
| </div> |
| |
| <h3>Contents</h3> |
| <img src="../../../images_www/articles/69/netbeans-stamp-69-70.png" class="stamp" |
| alt="Content on this page applies to NetBeans IDE 7.0, NetBeans 7.1, and NetBeans 7.2" |
| title="Content on this page applies to NetBeans IDE 7.0, NetBeans 7.1, and NetBeans 7.2"> |
| <table class="b-none vatop" cellpadding="0" cellspacing="0"> |
| |
| <tr> |
| <td class="hyphen">- </td> |
| <td><a href="#questionmark" title="What To Do When Your Project Has a |
| Question Mark in the Projects Window or a #include Directive is Underline |
| in Red">What To Do When Your Project Has a |
| Question Mark in the Projects Window or a #include Directive is Underline |
| in Red</a></td> |
| </tr> |
| |
| <tr> |
| <td class="hyphen">- </td> |
| <td><a href="#multiplatform" title="Configuring Code Assistance for a |
| Multi-Platform Project">Configuring Code Assistance for a |
| Multi-Platform Project</a></td> |
| </tr> |
| <tr> |
| <td class="hyphen">- </td> |
| <td><a href="#cannotbuild" title="Configuring Code Assistance When You |
| Cannot Build the Project">Configuring Code Assistance When You |
| Cannot Build the Project</a></td> |
| </tr> |
| <tr> |
| <td class="hyphen">- </td> |
| <td><a href="#definitiondeclaration" title="When a Hyperlink Goes to a |
| Function Definition and When to a Declaration">When a Hyperlink Goes to a |
| Function Definition and When to a Declaration</a></td> |
| </tr> |
| <tr> |
| <td class="hyphen">- </td> |
| <td><a href="#namespace" title="Finding All Definitions of a |
| Namespace">Finding All Definitions of a Namespace</a></td> |
| </tr> |
| <tr> |
| <td class="hyphen">- </td> |
| <td><a href="#declaration" title="Seeing the Declaration Name of a |
| Declaration Made in a Macro">Seeing the Declaration Name of a |
| Declaration Made in a Macro</a></td> |
| </tr> |
| </table> |
| |
| |
| <h2><a name="questionmark"></a>What To Do When Your Project Has a |
| Question Mark in the Projects Window</h2> |
| <p> |
| If your project has a question mark in the Projects window, or a |
| <tt>#include</tt> |
| directive is underlined in red, then your project has unresolved include directives. The IDE uses internal parser |
| that is used by Code Assistance features (Code Completion, Classes window, |
| Navigator window, etc). The markings mean that this parser cannot resolve some |
| <tt>#include</tt> directives, because the IDE project has wrong configuration. |
| </p> |
| <p> |
| Here are some possible reasons (arranged on probability, from most to least |
| probable):</p> |
| <ul> |
| <li>Wrong or insufficient user include paths specified in the project, logical |
| folder, or file properties</li> |
| <li>Wrong or insufficient user-defined macros specified in the project, logical |
| folder, or file properties</li> |
| <li>Source file is included in the project by mistake</li> |
| <li>Header file is not included in any source files and hence is included in |
| the project by mistake</li> |
| </ul> |
| |
| |
| <p> |
| Try launching the Configure Code Assistance wizard by right-clicking the |
| project and choosing Code |
| Assistance > Configure Code Assistance. It helps to resolve the problem. |
| If you know exactly where the files are that correspond to the failed include |
| directive located, then you can setup the project, logical folder, and file |
| properties manually. |
| </p> |
| <h2><a name="multiplatform"></a>Configuring Code Assistance for a |
| Multi-Platform Project</h2> |
| <p> |
| If you are developing a multi-platform project from existing code, you can use |
| the same IDE project for different platforms. Just create a configuration per |
| platform and change the compiler collection, compiler options and other |
| project properties appropriately. |
| </p> |
| |
| <p>The Configure Code Assistance wizard also works on a per-configuration |
| basis: it alters only the configuration that is currently active. So you can |
| run it separately for each configuration, and get different code assistance |
| settings for different platforms. |
| </p> |
| |
| <h2><a name="cannotbuild"></a>Configuring Code Assistance When You Cannot Build the Project</h2> |
| <p>The Configure Code Assistance wizard is most efficient if you built |
| your code with debugging information (the best options are <tt>-g3 |
| -gdwarf-2</tt> for GNU compilers and just<tt>-g</tt> for Sun compilers. |
| </p> |
| |
| <p>But in the case that your project is not built or does not contain debugging |
| information, the Configure Code Assistance wizard has a special mode, Search |
| file system for C/C++ header files. In this mode, the NetBeans IDE tries to |
| resolve failed include directives by searching the file system for headers. |
| For this purpose the wizard asks you to enter the path to search for |
| headers. By default, it is a project source root. |
| </p> |
| |
| <h2><a name="definitiondeclaration"></a>When a Hyperlink Goes to a |
| Function Definition and When to a Declaration</h2> |
| <p> |
| A hyperlink from function usage tries to find the function definition in |
| opened projects. If the function definition is not found in opened projects, |
| then the hyperlink jumps to the function declaration. |
| </p> |
| |
| <p>A hyperlink from a function declaration tries to find the function |
| definition in opened projects. If it succeeds, then it opens the |
| definition.</p> |
| <p>A hyperlink from a function definition infrastructure tries to find the |
| function declaration in opened projects. If it succeeds, then it opens |
| the declaration. |
| </p> |
| <h2><a name="namespace"></a>Finding All Definitions of a Namespace</h2> |
| <p> |
| A namespace can be defined in different files of the project. To navigate |
| between different namespace definitions, use the Classes window (Ctrl-9). |
| Right-click the namespace you are interested in and |
| choose All Declarations. You will see a list of all definitions sorted by file |
| names. |
| </p> |
| |
| <p>But in the case that your project is not built or does not contain debugging |
| information, the Configure Code Assistance wizard has a special mode, Search |
| file system for C/C++ header files. In this mode, the NetBeans IDE tries to |
| resolve failed include directives by searching the file system for headers. |
| For this purpose the wizard asks you to enter the path to search for |
| headers. By default, it is a project source root. |
| </p> |
| <h2><a name="declaration"></a>Seeing the Declaration Name of a |
| Declaration Made in a Macro</h2> |
| <p> |
| Sometimes macros are used to declare functions, namespaces, and variables. |
| To see how the macro was expanded in the source code to introduce a |
| declaration, use the Navigator window (Ctrl-7) and put the cursor on the macro-based declaration. |
| Navigator will select the correspondent language declaration in its view. |
| </p> |
| |
| |
| <div class="feedback-box"><a href="mailto:users@cnd.netbeans.org?subject=subject=Feedback:%20C/C++%20Application%20How-Tos%20-%20NetBeans%20IDE%206.8">Send Feedback on This Tutorial</a><br style="clear:both;"> |
| |
| </div> |
| |
| </body> |
| </html> |