Emacs 24.4.1 Ultimate C + + Smart Tips Solution

Source: Internet
Author: User

Using Ycmd mode plus the Company-mode described earlier

Download and install Ycmd server first

Reference, key content has been cut out

Building

[Clients commonly build and set up ycmd for you, you is unlikely to need tobuild ycmd yourself unless, want to build a New client.]

This is all for Ubuntu Linux. Details on getting ycmd running to other OS ' s can befound in YCM ' s instructions (ignore the vim-specific parts).

First, install the dependencies:

sudo apt-get install build-essential cmake python-dev

When you first clones the repository you'll need to update the submodules:

git submodule update --init --recursive

Then run ./build.py --clang-completer --omnisharp-completer --gocode-completer . This should get going.

For more detailed instructions in building ycmd, see YCM ' sinstructions (ignore the vim-specific parts).


Once compiled, a ycmd directory with the same name appears in the Ycmd directory. This path and so on will be needed.


Then install the Ycmd and company modules with the package system

This is no longer elaborate.


Configure the Init.el file as follows

;; Company mode (add-hook ' C++-mode-hook ' Global-company-mode);; Ycmd (Require ' ycmd) (Add-hook ' C++-mode-hook ' Ycmd-mode) (set-variable ' Ycmd-server-command ' ("Python"/home/dean/ Work/software/ycmd/ycmd ")) (Set-variable ' ycmd-extra-conf-whitelist ' ("/home/dean/work/gitlab/gitlab.com/ cppwizard/console/* ")) (Require ' Company-ycmd) (Company-ycmd-setup)


Configuring a dedicated Ycmd file for C + + engineering

The file can be copied from the Ycmd example directory, called. ycm_extra_conf.py, and put it here.

/home/dean/work/gitlab/gitlab.com/cppwizard/console/*


I made the changes, mainly changed the Include directory, deleted the configuration of object C

Flags = ['-wall ', '-wextra ', '-werror ', '-fexceptions ', '-dndebug ', # this is important! Without a "-std=<something>" flag, Clang won ' t know which# language to use when compiling headers. So it would guess. Badly. So c++# headers would be compiled as C headers. You don ' t want it all specify# a "-std=<something>". # for a C project, and you would set this to something like ' C99 ' instead of# ' c++11 '. ' -std=c++11 ', # ... and the same thing goes for the magic-x option which specifies the# language so the files to be Compil Ed is written in. This was mostly# relevant for C + + headers.# for a C project, and you would set the this to ' C ' instead of ' C + + '. -X ', ' C + + ', '-isystem ', '/usr/include ', '-isystem ', '/usr/local/include ', '-isystem ', '/home/dean/work/gitlab/ Gitlab.com/cppwizard/console/include ']

Use it, restart Emacs, enter C + + code to start editing, the first time will say wait for service to start, then later, try again. will see very comfortable hints, not only the standard library can automatically prompt, their own code is OK.







Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Emacs 24.4.1 Ultimate C + + Smart Tips Solution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.