Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Handling of PCH / forced includes by indexer

There is "Include Files" tab in Paths&Symbols which can show up if you enable it in Preferences->C/C++->Property Pages Settings. It is supposed to define pre-included files.

Andrew

On Mon, Feb 13, 2012 at 5:52 PM, Dmitry Nezhevenko <dion@xxxxxxxxx> wrote:
On Mon, Feb 13, 2012 at 02:41:02PM -0800, Sergey Prigogin wrote:
> Doing this with additional header files was wrong to begin with. The
> supported way of letting CDT parser know about includes and defines is
> through Paths and Symbols preference settings. See also Discovery Options
> preference page.

I've double checked both options. It's possible to specify where to look
for includes or to specify some "global" definitions, that are passed as
"-D" to compiler.

But my case is a bit different. For example if I've followed c++ file:

       #include <iostream>

       int main()
       {
               my_log("Hello world!");
               return 0;
       }

It definitely will not be compiled/parsed since my_log() function is not
defined.

But if I try to compile it using followed command-line call:

       gcc -include my_globals.h main.cpp

it'll be compiled correctly. "-include" behavior is like writing #include
as first line of source file.

It looks like now it's impossible to get same behavior. The best that can
be done is to add -include to discovery options that will import at least
preprocessor definitions (but not typedefs, function declarations, etc)

--
WBR, Dmitry
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev


Back to the top