Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [c++]

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

9
votes
1answer
575 views

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 ...
1
vote
1answer
34 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 ...
1
vote
1answer
153 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" ...
0
votes
1answer
74 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
1answer
717 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 ...
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
56 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
150 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 ...
1
vote
0answers
51 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
59 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
729 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 ...
1
vote
0answers
36 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
0answers
293 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
131 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
315 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
70 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
40 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
316 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
175 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
911 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
23 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
0answers
26 views

C++ Flycheck and the include-template-impementation-in-header trick

I'm running emacs 25.3.2 with a current flycheck installed. Flycheck uses clang-5 as a checker for C++. I like to keep my declarations and definitions separated in two files even when working with ...
0
votes
0answers
131 views

How to tell Emacs where h or hpp header file is, in cpp mode?

My .cpp file is not in the same folder as the h or hpp file. therefore #include "../../.." in the cpp file is underlined. My question is: How do I tell Emacs where to look for the header file?
0
votes
0answers
73 views

Debugging with gdb does not allow user to enter multiple console inputs

I wrote the following C++ program in Emacs named check_emacs_debug.cpp #include <iostream> int main() { for(int i = 0; i < 10; ++i) //Breakpoint { int num; std::...
0
votes
0answers
42 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....
0
votes
0answers
151 views

Autocomplete fails when adding C++ standard header files

I want both autocomplete support for C++ keywords and C++ standard headers. In other words, I want A keyword like while to be autocompleted. An expression like #include <iostream> to be ...
0
votes
0answers
215 views

Indentation after cout in C++ mode

I have a problem with indentation after: cout << "...." ....; lines in c++-mode. Expected cursor position after pressing Enter is the next line and column is right under cout. But as you may ...
0
votes
0answers
650 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
0answers
137 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
192 views

Missing line breaks in flycheck/cppcheck

I'm using the spacemacs syntax-checking layer on my C++ code (under the covers, this uses flycheck and cppcheck). Some messages coming back from cppcheck extend across multiple lines. Specifically, I'...
0
votes
0answers
375 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
321 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
469 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 ...
-1
votes
0answers
35 views

Flycheck C++ “to_sting” not found

If I try // to_string example #include <iostream> // std::cout #include <string> // std::string, std::to_string int main () { std::string pi = "pi is " + std::to_string(3....