Hi Rodrigo,
First, you need to make your code complete by adding a } to the end of
main in your example. Semantic will sometimes try to work around the
incomplete code, but it does not always succeed.
Next, if this is there *very first* .cpp file you pull into Emacs after
initializing Emacs and CEDET, then it may have failed to init properly.
That is an issue I noticed with a CVS version of Emacs just before
CEDET was integrated into Emacs. You can work around that by calling
M-x revert-buffer in your file.
Once all that is done, it should instead complain that it doesn't know
what "vector" is. In that case, just call it std::vector, and
everything should be good to go. If not, disable exuberent ctags
support which parsers differently from the Semantic parser, and delete
your ~/.semanticdb cache for /usr/include.
Eric
Rodrigo Canellas wrote:
> Hi,
>
> I have the following lines in my '.emacs':
>
> "
> ;; cedet configuration/mode.
> (global-ede-mode 1)
> (global-semanticdb-minor-mode 1)
> (global-srecode-minor-mode 1)
>
> (require 'semanticdb)
> (global-semanticdb-minor-mode 1)
>
> ;;If you use GCC for programming in C & C++, then Semantic can
> automatically find path, where system include files are located. To do
> this, you need to load semantic-gcc package with following command:
> (require 'semantic-gcc)
>
> ;; ;; if you want to enable support for gnu global
> (require 'semanticdb-global)
> (semanticdb-enable-gnu-global-databases 'c-mode)
> (semanticdb-enable-gnu-global-databases 'c++-mode)
>
> ;; ;; Explicitly specify additional paths for look up of include files
> (semantic-add-system-include "/usr/include" 'c++-mode)
> (semantic-add-system-include "/usr/include/c++/4.4" 'c++-mode)
> (semantic-add-system-include "/usr/include/c++/4.4/bits" 'c++-mode)
> ;; (semantic-add-system-include "/usr/local/include" 'c++-mode)
> (semantic-add-system-include "/home/dvp/build/x86_linux_g++/include/" 'c++-mode)
>
> ;; ;; Explicitly generate tags databases for often used directories
> (/usr/include, /usr/local/include, etc.)
> ;;(semanticdb-create-ebrowse-database "/home/dvp/build/x86_linux_g++/include/")
> ;; (semanticdb-create-ebrowse-database "/usr/include")
> ;; (semanticdb-create-ebrowse-database "/usr/local/include")
>
>
> ;; # enables only minimum of necessary features — keep syntactic
> information for current buffer up-to date, storing of syntactic
> information for later use (Semanticdb), and loading of corresponding
> information with Semanticdb and Ebrowse;
> ;; enables senator-minor-mode for navigation in buffer,
> semantic-mru-bookmark-mode for storing positions of visited tags, and
> semantic-idle-summary-mode, that shows information about tag under
> point;
> ;; enables semantic-stickyfunc-name that displays name of current
> function in topmost line of buffer, semantic-decoration-mode to
> decorate tags, using different faces, and
> semantic-idle-completion-mode for automatic generation of possible
> names completions, if user stops his work for some time;
> ;; enables which-func-mode, that shows name of current function in status line;
> (semantic-load-enable-excessive-code-helpers)
>
>
> ;; To use additional features for names completion, and displaying of
> information for tags & classes
> (require 'semantic-ia)
>
> ;; Semanticdb can use databases generated by external utilities —
> gtags from GNU Global, ctags, ebrowse & cscope. To activate this you
> can use following code:
> ;; enable ctags for some languages:
> ;; Unix Shell, Perl, Pascal, Tcl, Fortran, Asm
> (semantic-load-enable-all-exuberent-ctags-support)
>
> ;; Implements folding functionality
> (global-semantic-tag-folding-mode 1)
>
> ;; Search will performe only in given tags.
> (senator-isearch-toggle-semantic-mode)
>
> ;; In this mode names completions are shown automatically if user
> stops its work for a some time (idle time). By default, only first
> possible completion is shown, and user can use the TAB key to navigate
> through list of possible completions.
> ;;(semantic-idle-completions-mode 1)
>
> ;; semantic mode
> ;;(semantic-load-enable-minimum-features)
> ;;(semantic-load-enable-semantic-debugging-helpers)
> ;;(semantic-load-enable-code-helpers)
> ;;(semantic-load-enable-gaudy-code-helpers)
> ;;(semantic-complete-analyze-inline)
>
>
> ;; semantic-db mode
> (semanticdb-enable-gnu-global-databases 'c-mode)
> (semanticdb-enable-gnu-global-databases 'c++-mode)
> "
>
> If I create this file:
>
> "
> #include <vector>
>
>
> int main ( ) {
> vector<int> v;
>
> v.
> "
>
> When I type the '.' after the 'v', I get the message:
>
> "
> Cannot find types for `"v"'
> "
>
>
> What should I do to get 'semantic' to complete symbols from C++ headers?
>
>
>
> Thanks a lot!
>
>
> --
> Rodrigo Canellas
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> cedet-semantic mailing list
> cedet-semantic@...
> https://lists.sourceforge.net/lists/listinfo/cedet-semantic
>
|