Skip to content

A spacemacs configuration for a fully featured C/CPP IDE

Notifications You must be signed in to change notification settings

spandanji/Emacs-C-CPP-IDE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Emacs-C-CPP-IDE

A spacemacs configuration for a fully featured C/CPP IDE

Installation

  1. Place .emacs.d at ~
  2. copy .spacemacs to ~
  3. Install adobe source pro fonts for a cleaner truetype experience
  4. Install clang
  5. Install emacs or emacs-noX

To-Do

  1. Make an automation script to set it all up.
  2. Release a lightweight version keeping packages used to a bare minimum.(Stripping stuff off Spacemacs that we won't need)
  3. Add detailed usage to setup projects and using CMake to enhance auto completions and also use make an automation script for this.
  4. Add a graphical illustration here

Auto-competion and error checking

Auto-competion and error checking

  1. The autocompletions are from OpenCV4
  2. Note that when a=4 is written there is a sign in the status bar below right after C++//1 which shows the number of errors.
  3. If you hover at a=4 the error message is shown right below the status bar.

LibTorch

  1. Error Checking has been turned off here
  2. Just an example of writing and compiling ( HELM XD)

Usage

The generate.cpp is used to generate the .clang_complete file at the root directory of the project to generate autocompletions. We'll assume that you are using a CMake project.

Step 1: Generating the compilation database with CMake:

cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 . This step is the standard way for generating the compilation database with CMake. You can also use an existing compilation database but bear in mind that generate.cpp has been designed to parse only the ones generated by CMake and not other third party alternatives till date like bear. This step produces a compile_commands.json which will be used shortly.

Step 2: Compiling generate.cpp:

clang++ generate.cpp -std=c++11 -I. -o generate Compiling generate.cpp is straightforward and the only requirement is a C++11 capable compiler which is automatically obtained on installing a fairly recent version of clang (after all it's 2019). You can also give optimization and other flags to suit your needs (-O3 for speed in general).

Step 3: Generating the code completion file

./generate compile_commands.json > .clang_complete Pass the path to the JSON Compilation Database file as a command-line parameter to generate and then pipe the output from stdin to .clang_complete file in the current directory or to any other location according to your needs as long as the final location of the clang complete file is the root directory of the project.

Note: You can also create a separate build directory and then generate your clang complete file for more complicated project file structures:

mkdir build
cd build
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 ..
cd ..
clang++ generate.cpp -std=c++11 -I. -o generate
./generate build/compile_commands.json > .clang_complete

Configuration

For configuration of the flags, look into the source code of generate.cpp which is self explanatory. Make your changes to suit your needs, compile it and use -> profit :)

About

A spacemacs configuration for a fully featured C/CPP IDE

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published