What To Do When Your Project Has a
Question Mark in the Projects Window
If your project has a question mark in the Projects window, or a
#include
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 above means that this parser cannot resolve some
#include directives.
It means that the IDE project has wrong configuration.
Here are some possible reasons (arranged on probability, from most to least
probable):
Wrong or insufficient user include paths specified in the project, logical
folder, or file properties
Wrong or insufficient user-defined macros specified in the project, logical
folder, or file properties
Source file is included in the project by mistake
Header file is not included in any source files and hence is included in
the project by mistake
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.
Configuring Code Assistance for a
Multi-Platform Project
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.
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.
Configuring Code Assistance When You Cannot Build the Project
The Configure Code Assistance wizard is most efficient if you built
your code with debugging information (the best options are -g3
-gdwarf-2 for GNU compilers and just-g for Sun compilers.
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.
When a Hyperlink Goes to a
Function Definition and When to a Declaration
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.
A hyperlink from a function declaration tries to find the function
definition in opened projects. If it succeeds, then it opens the
definition.
A hyperlink from a function definition infrastructure tries to find the
function declaration in opened projects. If it succeeds, then it opens
the declaration.
Finding All Definitions of a Namespace
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.
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.
Seeing the Declaration Name of a
Declaration Made in a Macro
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 it's view.