Questions tagged [c++]

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

Filter by
Sorted by
Tagged with
3
votes
1answer
112 views

How to us a shortcut to add semicolon to end of current line?

Is there a shortcut to add a semicolon to the end of the current line of code? For instance, M-; inserts a comment at the end of the current line of code. Is there anything like that for a semicolon? ...
0
votes
0answers
28 views

GNU global prefers goto definition instead of goto to declaration

How I find a declaration of a cpp class or struct by GNU global for now. search a class name with Emacs gtags plugin such as ggtags or counsel-ggtags) the constructor or destructor of the class is ...
1
vote
1answer
18 views

How to see brief location in the code in C/C++ mode

While editing a long C++ file, I use rtags to jump around. It would be very handy for me to know where I am in terms of where the cursor is relative to the classes-functions. For example, it would be ...
1
vote
0answers
35 views

debugging c++ code with dap-mode in Emacs does not display std::variables (e.g., vector, map, etc) correctly. Any idea to solve this problem?

When I debug c++ code in dap-mode with Emacs, the std::variables, such as vector and map, always have values, [0]: std, shown in the local variable area. Does anybody know what is going on? I am on ...
0
votes
0answers
33 views

Make lsp recognize external c++ header

I am trying to develop an application with gtk3 in c++ and I am using Spacemacs as my main emacs distribution in addition to lsp for c++. In my main cpp file, I included the following header : #...
0
votes
0answers
11 views

Custom indentation blocks in c++-mode?

Is it possible/easy to add custom markers for the start/end of indentation blocks in c++-mode? I'd like the indentation of a block of code like BOOST_AUTO_TEST_SUITE(SuiteName) // <<TestCases&...
0
votes
0answers
37 views

Static function highlighting/locking in C++

In C++ mode, I am finding that static functions are only highlighted when written in the form static ReturnType function_name(args), and not when written ReturnType static function_name(args). Image: ...
0
votes
1answer
181 views

Error running timer ‘lsp--on-idle’: (error "The connected server(s) does not support method textDocument/documentLink

I'm trying to setup C++ IDE on spacemacs. Below are the layers configured . dotspacemacs-configuration-layers '( helm (auto-completion :variables auto-...
1
vote
2answers
57 views

Why does flycheck open a new buffer for error messages?

So I am using flycheck for my C++ projects with this setup: ;; Require flycheck to be present (require 'flycheck) ;; Force flycheck to always use c++11 support. We use ;; the clang language backend ...
0
votes
1answer
50 views

How to align operands in c++-mode?

I'm trying to get Emacs to align operands vertically. Current behaviour #include <iostream> void main() { std::cout << 1 + 2 + 3; return 1 + 2 + 3; } Wanted ...
1
vote
1answer
43 views

Different indentation in files with same modes

My .cxx files have 8-character indentation, while .cpp files have 4-character one. They have exact same modes enabled: My auto-mode-alist has the following c++ lines: ("\\.ii\\'" . c++-mode) ("\\.h\...
0
votes
0answers
8 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
174 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 ...
1
vote
0answers
58 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
13 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-...
4
votes
0answers
836 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-...
1
vote
0answers
27 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
10 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 ...
0
votes
0answers
32 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
52 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 ...
1
vote
0answers
109 views

How do you guys use doxygen? [closed]

I'm curious about Doxygen, how do you guys manage documentation in C/C++ projects on emacs? I didn't find a good package that does it consistently. So far I did use gendoxy and doxymacs. I had ...
1
vote
0answers
42 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 ...
0
votes
1answer
92 views

How to hide header line in C++ mode?

I really don't want emacs to show me which function the pointer is currently inside. (See the photo) What is the name of that frame? How can I remove it or make show an empty line? I am using Emacs ...
1
vote
0answers
66 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() && { ...
2
votes
0answers
237 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?
0
votes
1answer
226 views

cmake-ide defining variables

I have a project I build using cmake. To build this project, I need to define several options like -DPRODUCT=amd64 -DXML_DIR=/opt/xml_database Normally, I either pass these as -D or configure them in ...
4
votes
1answer
186 views

Is there a way to disable multi-line string literals in c++-mode?

Suppose I have a short string in C++ and I accidentally delete the double quote that ends it. What Emacs does is highlight the rest of the code as a single very long string, which messes up all the ...
2
votes
1answer
81 views

autofill a cpp file based on the .h file

suppose I have x.h class X { void f(); void g(); } in x.cpp #include "x.h" can I just entry a command with "X" as a parameter, then I can get void X::f() {} void X::g() {}
2
votes
1answer
114 views

Emacs indents C++ functions in structs in an unexpected way

Emacs indents functions in structs in the following way: struct A { int a() { return 1; } int b() { return 2; } } int c() { return ...
7
votes
1answer
5k views

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-...
0
votes
0answers
65 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 ...
1
vote
0answers
328 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
1answer
119 views

Problem debugging in `gud-mode' (M-x `gdb' with `many-windows' enabled)

I'm debugging a large codebase (written in C++). Everything works perfectly if I run gdb from a regular terminal as follows: $ gdb <program-name> Reading symbols from <program-name>......
1
vote
0answers
170 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 { ...
0
votes
2answers
102 views

How to configure C-M-q and TAB key to expand pre-existing TAB characters into spaces in C/C++ files

In C and C++ files, I want to configure the mode so that any time I request indentation, that it will always expand all of the embedded TAB characters in indentation (at the start of the line, and no ...
2
votes
1answer
410 views

What does the `/l` mean in the mode `C++/l` mean?

Just a simple question with more than likely a simple answer: What does the /l mean in the mode C++/l mean?
1
vote
1answer
195 views

Show constructor arguments for c++

Is there a package that can tell me the arguments for c++ constructor? class T1 { public: T1(int x, int y); }; T1::T1(int x, int y) { std::cout << x+y << std::endl; } ...
2
votes
0answers
400 views

Navigate C/C++ Source Code with Emacs [closed]

So, i'm finally starting to work with a multi-file Project in C++ and am in need for smart navigation and completion! So far, i've used company-mode (with irony and company-headers), which is great if ...
2
votes
1answer
411 views

how to call a c++ function from elisp

initially, i'am new to emacs. So I have little expierience with emacs. In past I used Visual Basic or VBA to work with the Output from some .dll. Now I'am working a little with emacs/elisp. My ...
6
votes
2answers
408 views

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 ...
1
vote
1answer
543 views

Extra indentation for argument lists beginning on a new line

I'm fine-tuning my C++ style using c-add-style, but I've reached an impasse where I cannot convince Emacs to (extra) indent arguments where the first argument starts on a new line. When I'm forced to ...
0
votes
1answer
159 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 ...
1
vote
1answer
122 views

How to indent c++ “special” source lines that don't end with semicolons

I'm working with a system that uses special macros a lot. For instance: class UDSSLib : public UFunctionLibrary { GENERATED_BODY() void foo(); int i; } The problem is the GENERATED_BODY() line....
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 ...
5
votes
2answers
12k views

How to compile and run a C++ file? [closed]

I don't know how to compile and run a C++ file in GNU Emacs. I searched on the various sites and stackexchange network, but from them what I understood was write something like make compile, and I don'...
1
vote
0answers
41 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
2answers
307 views

What is the good resource for getting started using EMACS? [duplicate]

I have not used EMACS seriously in 20 years. I work on a Mac and am a vi/Eclipse person now. I want to switch back to EMACS for C and C++ programming. When I was researching EMACS add-on packages ...
1
vote
2answers
389 views

Org-babel. :flags in C code blocks dont work correctly anymore

I'm trying to run current code block #+HEADERS: :includes <math.h> <stdio.h> :flags -lm #+HEADERS: :var x=1.0 :var y=4.0 :var z=10.0 #+begin_src C :tangle trying double pi = 4*atan(1); ...
1
vote
1answer
264 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" ...