Emacs CEDET for OpenCV C ++ interface

So, I used CEDET for a while, and everything works well overall. I am moving from using it from C to C ++, especially for OpenCV 2.3 (linux), and I'm having problems. I am using emacs24 with the latest version of the CEDET developer.

It is not possible to parse some characters and their elements, for example: KeyPoint, Mat, etc.

However, many AES functional characters are parsed, for example line(), imshow(), imread() , etc.

I am looking for help on how to debug errors in my setup or someone who has successfully configured opencv c ++ api.

Here is my relevant cedet configuration:

 ;; brian-cedet.el ;; Contains my personal configuration for CEDET ;; Loads for CEDET (load-file "/home/terranpro/code/cedet/common/cedet.el") (add-to-list 'Info-default-directory-list (expand-file-name "~/code/cedet/common")) (add-to-list 'Info-directory-list (expand-file-name "~/code/cedet/common")) (add-to-list 'Info-directory-list (expand-file-name "~/code/cedet/semantic/doc")) (add-to-list 'Info-directory-list (expand-file-name "~/code/cedet/eieio")) (add-to-list 'Info-directory-list (expand-file-name "~/code/cedet/speedbar")) (add-to-list 'Info-directory-list (expand-file-name "~/code/cedet/cogre")) (add-to-list 'Info-directory-list (expand-file-name "~/code/cedet/ede")) (add-to-list 'Info-directory-list (expand-file-name "~/code/cedet/srecode")) (require 'ede) (global-ede-mode t) ;;(semantic-load-enable-minimum-features) (semantic-load-enable-code-helpers) ;;(semantic-load-enable-gaudy-code-helpers) (semantic-load-enable-excessive-code-helpers) ;;(semantic-load-enable-semantic-debugging-helpers) (require 'semantic-ia) (require 'semantic-gcc) (require 'semantic-sb) (require 'semanticdb) (global-semanticdb-minor-mode 1) (require 'semanticdb-global) (semanticdb-enable-gnu-global-databases 'c-mode) (semanticdb-enable-gnu-global-databases 'c++-mode) (require 'semantic-c) (setq semantic-load-turn-useful-things-on t) (semantic-add-system-include "/usr/include/glib-2.0" 'c-mode) (semantic-add-system-include "/usr/include/glib-2.0" 'c++-mode) (semantic-add-system-include "/usr/include/gtk-3.0" 'c-mode) (semantic-add-system-include "/usr/include/gtk-3.0" 'c++-mode) (semantic-add-system-include "/usr/local/include/" 'c-mode) (semantic-add-system-include "/usr/local/include/" 'c++-mode) (semantic-add-system-include "/usr/local/include/opencv" 'c-mode) (semantic-add-system-include "/usr/local/include/opencv2" 'c++-mode) (semantic-add-system-include "/usr/local/include/opencv" 'c-mode) (semantic-add-system-include "/usr/local/include/opencv2" 'c++-mode) (add-to-list 'semantic-lex-c-preprocessor-symbol-file '"/usr/local/include/opencv2/core/types_c.h") (add-to-list 'semantic-lex-c-preprocessor-symbol-file '"/usr/local/include/opencv2/imgproc/types_c.h") (add-to-list 'semantic-lex-c-preprocessor-symbol-map '("CV_PROP_RW" . "")) (add-to-list 'semantic-lex-c-preprocessor-symbol-map '("CV_EXPORTS" . "")) (add-to-list 'semantic-lex-c-preprocessor-symbol-map '("CV_EXPORTS_W_SIMPLE" . "")) (defun my-cedet-hook () (local-set-key [(control return)] 'semantic-ia-complete-symbol) (local-set-key "\Cc?" 'semantic-ia-complete-symbol-menu) (local-set-key "\Cc>" 'semantic-complete-analyze-inline) (local-set-key "\Cc=" 'semantic-decoration-include-visit) (local-set-key "\C-cj" 'semantic-ia-fast-jump) (local-set-key "\C-cq" 'semantic-ia-show-doc) (local-set-key "\C-cs" 'semantic-ia-show-summary) (local-set-key "\C-cp" 'semantic-analyze-proto-impl-toggle) (local-set-key "\C-c+" 'semantic-tag-folding-show-block) (local-set-key "\Cc-" 'semantic-tag-folding-fold-block) (local-set-key "\Cc\C-c+" 'semantic-tag-folding-show-all) (local-set-key "\Cc\Cc-" 'semantic-tag-folding-fold-all)) (add-hook 'c-mode-common-hook 'my-cedet-hook) (add-hook 'emacs-lisp-mode-hook 'my-cedet-hook) (add-hook 'lisp-interaction-mode-hook 'my-cedet-hook) (global-semantic-tag-folding-mode 1) 
+4
source share
2 answers

Now I have a working configuration; thanks to Alex Ott and David Engster on the cedet-devel mailing list. To mark their corrections, there were some lines in my configuration that were "not needed and possibly harmful." After updating the configuration, deleting all files in ~ / .semanticdb and restarting emacs everything works as expected!

I also included a sample cpp file for testing the configuration. Thanks guys!

 (load-file "/home/terranpro/code/cedet/common/cedet.el") (require 'ede) (global-ede-mode t) ;;(semantic-load-enable-minimum-features) (semantic-load-enable-code-helpers) ;;(semantic-load-enable-gaudy-code-helpers) (semantic-load-enable-excessive-code-helpers) ;;(semantic-load-enable-semantic-debugging-helpers) ;; CEDET-devel mailing list said these werent needed ;; and possibly hurtful ;;(require 'semantic-ia) ;;(require 'semantic-gcc) ;;(require 'semantic-sb) ;;(require 'semanticdb) ;;(global-semanticdb-minor-mode 1) ;;(require 'semanticdb-global) (semanticdb-enable-gnu-global-databases 'c-mode) (semanticdb-enable-gnu-global-databases 'c++-mode) (require 'semantic-c) (setq semantic-load-turn-useful-things-on t) (semantic-add-system-include "/usr/local/include/" 'c-mode) (semantic-add-system-include "/usr/local/include/" 'c++-mode) (add-to-list 'semantic-lex-c-preprocessor-symbol-file '"/usr/local/include/opencv2/core/types_c.h") (add-to-list 'semantic-lex-c-preprocessor-symbol-file '"/usr/local/include/opencv2/imgproc/types_c.h") (add-to-list 'semantic-lex-c-preprocessor-symbol-map '("CV_PROP_RW" . "")) (add-to-list 'semantic-lex-c-preprocessor-symbol-map '("CV_EXPORTS" . "")) (add-to-list 'semantic-lex-c-preprocessor-symbol-map '("CV_EXPORTS_W_SIMPLE" . "")) (add-to-list 'semantic-lex-c-preprocessor-symbol-map '("CV_EXPORTS_W" . "")) (add-to-list 'semantic-lex-c-preprocessor-symbol-map '("CV_EXPORTS_W_MAP" . "")) (add-to-list 'semantic-lex-c-preprocessor-symbol-map '("CV_INLINE" . "")) (defun my-cedet-hook () (local-set-key [(control return)] 'semantic-ia-complete-symbol) (local-set-key "\Cc?" 'semantic-ia-complete-symbol-menu) (local-set-key "\Cc>" 'semantic-complete-analyze-inline) (local-set-key "\Cc=" 'semantic-decoration-include-visit) (local-set-key "\C-cj" 'semantic-ia-fast-jump) (local-set-key "\C-cq" 'semantic-ia-show-doc) (local-set-key "\C-cs" 'semantic-ia-show-summary) (local-set-key "\C-cp" 'semantic-analyze-proto-impl-toggle) (local-set-key "\C-c+" 'semantic-tag-folding-show-block) (local-set-key "\Cc-" 'semantic-tag-folding-fold-block) (local-set-key "\Cc\C-c+" 'semantic-tag-folding-show-all) (local-set-key "\Cc\Cc-" 'semantic-tag-folding-fold-all)) (add-hook 'c-mode-common-hook 'my-cedet-hook) (add-hook 'emacs-lisp-mode-hook 'my-cedet-hook) (add-hook 'lisp-interaction-mode-hook 'my-cedet-hook) (global-semantic-tag-folding-mode 1) 

And the CPP test file:

 #include <stdio.h> #include <vector> #include <string> #include <opencv2/opencv.hpp> #include <opencv2/core/core.hpp> #include <opencv2/imgproc/imgproc.hpp> #include <opencv2/features2d/features2d.hpp> #include <opencv2/highgui/highgui.hpp> using namespace cv; using namespace std; int main(int argc, char **argv) { KeyPoint k; Mat m; // m should have members like m.clone() // k has members like k.pt (Point2f pt) return 0; } 
+4
source

It seems that the semantic parser could not parse the class declaration - it considers its CV_EXPORTS Mat not like Mat itself, although CV_EXPORTS should be expanded to an empty line. I used the following configuration, and it worked fine for C code, but not C ++. I suggest you write a cedet-devel mailing list with examples - just write there, and if necessary I will provide more comments for your mail ...

 (ede-cpp-root-project "OpenCV/C++ test" :name "OpenCV/C++ test" :file "/Users/ott/development/opencv-examples/cpp/CMakeLists.txt" :include-path '("/" ) :system-include-path '("/opt/local/include" "/opt/local/include/opencv" "/opt/local/include/opencv2") :spp-table '( ("CV_PROP_RW" . "") ("CV_EXPORTS" . "") ("CV_EXPORTS_W_SIMPLE" . "") ("CV_EXPORTS_W" . "") ("CV_EXPORTS_W_MAP" . "") ("CV_INLINE" . "")) :local-variables (list (cons 'semantic-lex-c-preprocessor-symbol-file (cons "/opt/local/include/opencv2/core/types_c.h" (cons "/opt/local/include/opencv2/imgproc/types_c.h" semantic-lex-c-preprocessor-symbol-file))))) 
+3
source

Source: https://habr.com/ru/post/1393309/


All Articles