1

Emacs 24.2, Cedet 1.1, Windows 7

Visual Studio 10.0 Include directory

(add-to-list 'load-path " ~/.emacs.d/cedet-1.1/common")
(load-file "~/.emacs.d/cedet-1.1/common/cedet.el")

(semantic-load-enable-excessive-code-helpers)
(semantic-load-enable-semantic-debugging-helpers)

(require 'semantic-decorate-include)

(require 'semantic-ia)

(global-ede-mode nil)

(setq-mode-local c-mode semanticdb-find-default-throttle
                 '(project local unloaded system recursive))
(setq-mode-local c++-mode semanticdb-find-default-throttle
                 '(project local unloaded system recursive))

(semantic-add-system-include "C:/Program Files/Microsoft Visual Studio 10.0/VS/Include" 'c++-mode)

When writing c++ program and include, say, iostream, it navigates to this include file, but is not able to parse it. On the other hand when include, say, stdlib.h it parses successfully such an include.

How to fix this?

1 Answer 1

1

Found some workaround. Need to tell C lexer to parse Microsoft include files with defines like this

(defun windows-semantic-hook ()
    (setq microsoft-base-dir 
        "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include")
    (add-to-list 'semantic-lex-c-preprocessor-symbol-file 
               (concat microsoft-base-dir "/crtdefs.h"))
    (add-to-list 'semantic-lex-c-preprocessor-symbol-file 
               (concat microsoft-base-dir "/yvals.h"))
    (add-to-list 'semantic-lex-c-preprocessor-symbol-file 
               (concat microsoft-base-dir "/vadefs.h"))
    (add-to-list 'semantic-lex-c-preprocessor-symbol-file 
               (concat microsoft-base-dir "/comdefsp.h"))
    (semantic-add-system-include microsoft-base-dir 'c++-mode)
    (add-to-list 'auto-mode-alist (cons microsoft-base-dir 'c++-mode)))

(add-hook 'semantic-init-hooks 'windows-semantic-hook)

Now semantic parser feels better (but not completely good) and is able to parse some includes like <string>, <map> etc.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .