On 28/10/12 21:31, David Engster wrote:
> David Engster writes:
>> It's a bug. As a workaraound, do the setting in the c-mode-hook like this:
>> (add-hook 'c-mode-hook
>> '(lambda ()
>> (semantic-add-system-include "/usr/include/glib-2.0/" 'c-mode)))
>> If you do the setting in .emacs before semantic/bovine/c is loaded, it
>> will get reset. The funny thing is that this does not happen for c++,
>> because it is defined as a child mode.
>> This issue will be fixed - I'm just not sure how yet.
Thank you for your input, David.
I managed to overcome this issue in the following manner:
(defun hook-setup-semantic ()
(semantic-add-system-include "/path/to/include" 'c-mode)
(semantic-add-system-include "/path/to/include" 'c++-mode)
(add-hook 'semantic-init-hooks 'hook-setup-semantic)
This workaround fixes the issues I was having with c-mode only system
wide includes not being included - semantic was dropping the
definitions. Thanks to you I now know why that happens!
> Let me add that the best solution is to use `ede-cpp-root-project',
> where you can specify system includes for your different projects. Or do
> you really have conflicting header files in glib and glibmm and have to
> use both in one project? Now that would be a pretty special problem.
The issue here is that semantic fails to parse Glibmm headers because it
detects /usr/include/glibmm-3.0/glibmm.h - GLibmm's master include - as
being a C header rather than C++. After all, its extension is .h and
there's no mode hint in the comments, and so semantic assumes (rightly
so, perhaps) that it is dealing with a C header. Now, being a master
include header, glibmm.h includes all of GLibmm's headers and because
semantic considers glibmm.h a C header, the only way to let semantic
know where to find the headers is by duplicating the add-system-include
statement for c-mode as well.
You're right in that I don't need GTK and GLib includes in C++; just
GTKmm and Glibmm! :)
> Still, I guess we should rework that area of adding system
> includes. Using `semantic-add-system-include' before semantic/bovine/c
> is loaded only works for C++, and that only by chance. Things are even
> made more complicated by the fact that we have the
> `semantic-c-dependency-system-include-path' variable, which works like
> an alias for `semantic-dependency-system-include-path' in c-mode and can
> be customized or set through `setq-default'.
Thanks again for taking the time.