Questions tagged [c++]

Questions related to the C++ language or the cc-mode

40 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4
votes
0answers
2k views

Support C++11 syntax in c++-mode

I want correct indentation with my C++ code. The following piece of code indents properly. It nicely indents the access label and the member declaration independently. class Test : public Base { ...
3
votes
0answers
510 views

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-...
3
votes
0answers
1k views

Spacemacs C++ debugging?

What tools are you using for setting Breakpoints visualize Variables within Spacemacs? I had a look at gdb but it felt awkward to set the breakpoints separated from the source files. I would like to ...
3
votes
0answers
72 views

Working around preprocessor blocks

I am trying to navigate a C project that has lots of preprocessor directives like this: #ifdef SOME_COMPILE_TIME_VARIABLE for ( idx=0; idx<FOO; idx++ ) { #else for ( idx=0; idx<BAR; idx+...
3
votes
0answers
183 views

Class inheritance tree in ECB

I'd like to see the inheritance tree for classes which I have currently open, similarly to how it ECB shows related files (e.g. I have a class B in my buffer, its parent A and child C are in different ...
2
votes
0answers
196 views

Valgrind interface for emacs

Is there an interface similar to 'gdb-mi' for using Valgrind in emacs? What are some ways to use Valgrind inside emacs?
1
vote
0answers
22 views

Search for functions by type signature

Is there a convenient way to search through a C/++ codebase and list all the functions with matching type signatures? I'm working in a codebase that makes heavy use of function pointers. ...
1
vote
0answers
9 views

How do you fix a large list of unknown files in Ebrowse?

I'm trying to use the emacs Ebrowse tool. The issue I'm having is a great majority of the C++ files, from my BROWSE file, are showing up as (unknown) file type, resulting in me being unable to open ...
1
vote
0answers
40 views

Is there a package that show the value of constant variables? C/C++

I would like some package that show the variable value when I put cursor on it. The behavior that I expect can be seen in the image below. The image below is in vscode, I would like some package that ...
1
vote
0answers
62 views

How to fix indentation of C++ methods with ref-qualifiers?

Emacs in its default configuration seems to have trouble indenting C++ methods with reference qualifiers (& and &&). For example: struct foo { void a_method() && { ...
1
vote
0answers
275 views

Tools for refactoring c++ code

What tools do you use to refactor c++ code? For example, how do you rename a variable or function that is spread across files? If the problem isn't language specific, there are text-based tools that ...
1
vote
0answers
159 views

c++ mode indentation

If we have a class like the one below emacs is indenting the : (to the initialization list). To be able to match some other editor, is it possible in emacs to indent the : like below? class Test { ...
1
vote
0answers
40 views

Hide region from syntax highlighting and indentation

c++-mode does not handle the C++17 R"delim()delim" string literals. Is there a way to mark a region (via comments?) so it will not be syntax highlighted and will not confuse the indenter?
1
vote
1answer
238 views

trouble with flycheck-gcc-language-standard variable

I am attempting to use Directory-Variables in order to set the flycheck-gcc-language-standard variable. I used: M-x add-dir-local-variable RET c++-mode RET flycheck-gcc-language-standard RET "c++11" ...
1
vote
0answers
422 views

Emacs c++ cannot use semantic and company-semantic to complete <string> library function

system: linux mint 18.1 Eamcs version: 25.2 semantic configuration: (global-semanticdb-minor-mode 1) (global-semantic-idle-scheduler-mode 1) (semantic-mode 1) create a cpp file and include vector,...
1
vote
0answers
205 views

Should K&R indentation work in C++ code?

Given the following file, named as x.cpp I get the following unexpected indentation behavior: #include <stdio.h> class X { public: X() { // <-- Why the indent? ...
1
vote
0answers
433 views

prog-mode-hook not run for C++ mode

I am trying to turn on linum-mode and fci-mode for C++ editing. Here is my configuration: ;; If non nil line numbers are turned on in all `prog-mode' and `text-mode' ;; derivatives. If set to `...
1
vote
0answers
118 views

Getting gdb to work for this project

For this project, I cannot seem to get M-x gdb to work in Emacs 25.1 (on Ubuntu 14.04.5 64-bit if it matters - this should be the case for any Ubuntu-based Linux in general I imagine). Steps to ...
1
vote
0answers
55 views

C++ source highlight in Diff mode

I'd like to know if Emacs has an option to highlight the portions of C++ source inside .diff files generated by e.g. git diff HEAD~1 or git log -p Right now I have to rename my .diff file to ...
1
vote
0answers
427 views

Code completion for C++

I have just started using emacs, after coming from using Xcode. I would like to get code completion for C++, however there are a whole bunch of things that don't really explain what they do (at least ...
1
vote
0answers
210 views

company-mode on Windows partially completes

I installed LLVM on my Windows machine. And now I want Emacs tools to use it. I changed company-clang-executable to "path/to/LLVM/bin/clang.exe". Now I think it finds Clang but somehow completions ...
1
vote
0answers
1k views

Enable Irony-mode

I'm having some trouble trying to activate irony-mode. So i followed the steps: My version of gcc is 5.3.0 so I installed -> clang 3.7.1 I installed CMake Then irony from MELPA After that added this ...
0
votes
0answers
6 views

Focus ggtags-global when it spawns

When I find definitions ggtags-find-tag-dwim and there are multiple results it opens *ggtags-global* but the focus remains in my buffer that initiated the call to ggtags-find-tag-dwim. I'm trying to ...
0
votes
0answers
50 views

C++ auto completion is not working in spacemacs with clangd

I'm newbie to emacs/spacemacs. I'm using emacs version 26.3 I have installed spacemaces in my system using command git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d and rm ~/.emacs Now I'm ...
0
votes
0answers
24 views

Passing arguments to dap-mode (c++)

everyone. I am new to debugging with dap-mode and i can't figure out how to pass arguments. I tried by creating a template (dap-register-debug-template "GDB::Mine" (list :type "gdb" :...
0
votes
0answers
12 views

How to get first nested parameter indented based on outermost function

I would like to get the following cc-mode indentation behavior (c-basic-offset is 4): outerFunction(innerFunction( parameter1, parameter2)); However I would like to maintain arglist aligned ...
0
votes
0answers
33 views

Why certain rebind keys doesn't work in c++ mode?

I've recently started using emacs and wanted to customize the editor. So, I've tried to rebind certains keys, but It's doesn't to work no matter what I do. (global-unset-key (kbd "C-c") ) (global-set-...
0
votes
0answers
30 views

Spacemacs: smart search skips C++ files

emacs version: 26.1 Spacemacs version: 0.200.13 Spacemacs init is the default generated one. Smart search set to ag OR grep My git C++ project has C++ source and header files, plus python and text ...
0
votes
0answers
48 views

Stepping through c code in emacs

I am trying to step through code in emacs and am looking for a plugin which will displa the contents of an element when I hover over it. Is there any plugin like this currently? How do you step ...
0
votes
0answers
71 views

irony-mode producing too many errors

I am trying to use irony-mode with my project. I have installed the irony server using irony-install-server. I also have a CMakeLists.txt to produce the makefile for my project along the compile ...
0
votes
0answers
42 views

company is not showing popup complete in c/c++

This is my company config The problem is that with python or lisp when I start to type the popup is shown immediately, but in C/C++ this don't occur. However if I type C-n or C-p the completition is ...
0
votes
0answers
47 views

C++ Windows Compilation Error/Warning Regexp

I am trying to setup a compile for Emacs on Windows using the CL C++ compiler provided by Windows with Visual Studio 2017. https://imgur.com/a/M80uTWH as can be seen from the above image, however, ...
0
votes
0answers
51 views

Too much time spent for emacs to open cpp in the project

I use ggtags in order to improve my efficiency. I follow the manual to setup emacs environment. https://tuhdo.github.io/c-ide.html However, during editing the cpp files in the projects. Chance are ...
0
votes
1answer
144 views

CEDET semantic-complete-jump customization

When I search through project via semantic-complete-jump and tag is not unique (its defined in multiple places), I must hit <tab> to iterate through all possible places. Problem is, I horribly ...
0
votes
0answers
1k views

Flycheck c/c++-gcc doesn't understand C++

I get the following when trying to check a header file; -*- mode: compilation; default-directory: "~/devel/projects/SHARED/" -*- Compilation started at Wed Feb 15 16:06:41 gcc -fshow-column -fno-...
0
votes
1answer
1k views

Building targets using cmake-ide

I switched to emacs as my C++ ide. I am using irony mode, company, rtags, and since all of my projects are using cmake, cmake-ide. I cant realy find something online on how the workflow works with ...
0
votes
0answers
189 views

font-lock problem of c++ mode

I recently notice that there's some strange behaviours of the font-lock of the c++-mode. Let's start emacs by emacs -Q in the terminal, edit a new file test.cpp and save the following contents Then ...
0
votes
0answers
491 views

c/c++ disassembler for emacs and objdump

I'm trying to show assembly under the cursor in emacs (spacemacs, on mac os x) and although disaster.el does generate assembly with objdump, it fails to associate lines in source with lines in ...
0
votes
0answers
357 views

Non-Indentation of only C++ comments in C++ mode

How can I configure my ~/.emacs so as to get the following effect? In C++ mode, I want C++ comments (but not C-style comments), to always be unindented, i.e., the double slashes should always be ...
0
votes
0answers
537 views

Wrong indent in c-mode and c++-mode

In my coding style tabs used to indent and spaces for align. I've configure Emacs for this, but some times emacs places 4 spaces instead of tabulation in some blocks of code. If can be fixed by ...