Questions related to the C++ language or the cc-mode
Questions tagged [c++]
148 questions
56
votes
9 answers
Using Emacs as a full-featured C/C++ IDE
I have been trying off and on for over a year now to use Emacs as a C/C++ IDE. I have only been marginally successful thus far, but have run into a few brick walls along the way. Currently I am trying to use CEDET, but I am having a rough time…

nispio
- 8,175
- 2
- 35
- 73
50
votes
6 answers
How to get intelligent auto-completion in C++?
Emacs cannot compete with another other IDE if it doesn’t have an auto completion function. Auto-complete simply makes me a more efficient programmer. I know of the Auto Complete Mode extension, but it does not work with C++.
How can I achieve…

programking
- 7,064
- 9
- 41
- 62
14
votes
1 answer
Best C++ indexer?
I've recently switched over from Eclipse CDT to Spacemacs with the C++ layer as my development environment.
So far... awesome! However, one of the things I miss about Eclipse is its indexer.
At the moment I'm using GNU Global with the gtags layer.…

Steve Lorimer
- 545
- 4
- 13
12
votes
2 answers
Is there a yasnippet producing a prepopulated doxygen comment?
For the following C++ function:
bool importantStuff(double a, double b);
It should output the following snippet, perhaps without the tags:
/**
*
*
* @param a
* @param b

Rovanion
- 975
- 7
- 20
12
votes
3 answers
How can I get C/C++ context-sensitive completion with Company?
Semantic seems to be able to do this, but I cannot get it to work as I would expect it to. For example, if I #include "Type.h" and declare Type t, using semantic-complete-analyze-inline when point is after t. consistently gives me the error
Cannot…

Sean Allred
- 6,861
- 16
- 85
12
votes
2 answers
Display the beginning of a scope when it is out of screen
I would like to display the opening part of a scope when this one get out of screen.
Example:
namespace a
{
...
--------------------- <- display frame
... |
}* | * when cursor is here display "namespace a"…

log0
- 320
- 2
- 8
12
votes
2 answers
How to get semantic syntax highlighting on emacs for C/C++ code
I'm new to emacs and programming in general so please bear with me. I'm trying to use emacs as my C/C++ IDE, and I noticed that in CC mode the variables/functions seemed to be highlighted only during declaration. My question is
Is it possible to…

DJ lee
- 131
- 1
- 4
11
votes
1 answer
formatting constexpr if in c++-mode
I recently started using C++17, which brings constexpr if. This however screws up c++-modes default indentation.
// emacs 25.3.2 with --no-init
if constexpr (n == 1) {
// Why?
} else if constexpr (n == 2) {
// This is a mess...
} else {
…

topisani
- 113
- 4
11
votes
1 answer
Color declared variables
I'm looking for a simple way to make emacs remember of declared variable in a single function in C/C++. By "simple", I mean without any external package, just with some elisp lines in configuration files.
My default Emacs configuration colors…

Aracthor
- 173
- 7
10
votes
2 answers
disable specific warning in flycheck (specifically "#pragma once in main file")
I'm using flycheck for C++ development, and get the following warning:
#pragma once in main file
In all headers included in a main file. Searching the webs, I get the impression this has something to do with how gcc and clang (both give the same…

Spacemoose
- 877
- 1
- 7
- 18
7
votes
1 answer
How to debug C++ (dap-mode + LLDB or GDB)
I want to use dap-mode to debug a C++ code. Until now I followed instructions dap-mode (LLDB) and lldb-vscode. I further enabled the mode and UI via
(dap-mode 1)
(dap-ui-mode 1)
When I execute dap-debug I can select the LLDB template, but when…

DrDirk
- 223
- 2
- 6
7
votes
1 answer
lsp-mode: How to use built-in clangd client?
I'm trying to use lsp-mode (together with company-lsp) for auto completion in C++. According to the docs[0], recent lsp-mode includes clangd support, so I should be all set when I do (require 'lsp-clients). However, lsp-mode can't find any clients…

Lukas Barth
- 271
- 3
- 10
7
votes
3 answers
Better syntax-higlighting for member variables and function calls in cpp-mode
In atom, C++ files are well colored unlike emacs cpp-mode. Emacs does not highlight references to member variables, function calls or member functions. They all are uncolored.
The left is from emacs and the other is from atom:
See, emacs does not…

Hckr
- 171
- 1
- 4
6
votes
1 answer
How should I configure irony-mode if my project has no "compilation flags"?
irony-mode is: an Emacs minor-mode that aims at improving the editing experience for the C, C++ and Objective-C languages. It works by using a combination of an Emacs package and a C++ program (irony-server) that uses libclang. (provides code…

shackra
- 2,702
- 18
- 47
6
votes
2 answers
C++ mode: smartly use /*...*/ for comment-dwim
I want to adjust the behavior of comment-dwim when editing c++ files:
When a region is selected that either starts or ends in the middle of a line I would prefer /* ... */ comments. For the other cases // per line is fine.
Example:
int foo(int arg)…

B_old
- 717
- 5
- 14