A spacemacs configuration for a fully featured C/CPP IDE
- Place .emacs.d at ~
- copy .spacemacs to ~
- Install adobe source pro fonts for a cleaner truetype experience
- Install clang
- Install emacs or emacs-noX
- Make an automation script to set it all up.
- Release a lightweight version keeping packages used to a bare minimum.(Stripping stuff off Spacemacs that we won't need)
- Add detailed usage to setup projects and using CMake to enhance auto completions and also use make an automation script for this.
- Add a graphical illustration here
- The autocompletions are from OpenCV4
- 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.
- If you hover at a=4 the error message is shown right below the status bar.
- Error Checking has been turned off here
- Just an example of writing and compiling ( HELM XD)
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.
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.
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).
./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
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 :)