- Steps to reproduce minimal functionality
- Steps to install MSVC
- Some hard-earned tips
- C++ Boost naming convention
- Usefull VSCode Keyboard Shortcuts
- Personal Keyboard Shortcuts
- Usual errors
- Useful questions
- Install
ms-vscode.cpptools
extension. - Install
vector-of-bool.cmake-tools
extension. Ctrl+Shift+P
CMake: Select Kit
-> VisualStudio.14.0 - amd64 (Ninja is set on workspace settings).Ctrl+Shift+P
CMake: Set current build variant
-> Debug.Ctrl+Shift+P
CMake: Delete cached build settings and reconfigure
.Ctrl+Shift+P
CMake: Clean rebuild
.- F5 to Debug the first task on
launch.json
,build
ontasks.json
must also be executed.
- Install Windows SDK. Required for Ninja.
- Install Build Tools for Visual Studio. For vc140 (2015) install Visual C++ Build Tools or from here.
- Install Ninja
choco install ninja
. - Add windows environment
PATH
references.
- MSVC is the best generator for CUDA. Others like
gcc
andclang
are not fully supported. /FS
flag is required when building using Ninja generator and MSVC to avoid concurrentpdb
.- This is the solution that requires less disk memory of all. Installing VS2017 requires at least 20GB.
vcvarsall.bat x64
needs to be run before runningcmake --build
orcl.exe
.- Remove all unnecessary plugins from vscode, they might interfere to setting the
build variant
on the CMakevector-of-bool.cmake-tools
extension. - If you require to install an external library use
ninja install
to install it after building it in the same folder. Then usefind_package(library REQUIRED)
in CMakeLists.txt beforeTARGET_LINK_LIBRARIES(${target_name} namepace::library)
.
#ifndef NAMESPACE_NAMES_THEN_PRIMARY_CLASS_OR_FUNCTION_THEN_HPP
#define NAMESPACE_NAMES_THEN_PRIMARY_CLASS_OR_FUNCTION_THEN_HPP
#include <boost/headers/go/first>
#include <boost/in_alphabetical/order>
#include <then_standard_headers>
#include <in_alphabetical_order>
#include "then/any/detail/headers"
#include "in/alphabetical/order"
#include "then/any/remaining/headers/in"
// (you'll never guess)
#include "alphabetical/order/duh"
#define NAMESPACE_NAMES_THEN_MACRO_NAME(pMacroNames) ARE_ALL_CAPS
namespace lowercase_identifers
{
class separated_by_underscores
{
public:
void because_underscores_are() const
{
volatile int mostLikeSpaces = 0; // but local names are condensed
while (!mostLikeSpaces)
single_statements(); // don't need braces
for (size_t i = 0; i < 100; ++i)
{
but_multiple(i);
statements_do();
}
}
const complex_type& value() const
{
return mValue; // no conflict with value here
}
void value(const complex_type& pValue)
{
mValue = pValue ; // or here
}
protected:
// the more public it is, the more important it is,
// so order: public on top, then protected then private
template <typename Template, typename Parameters>
void are_upper_camel_case()
{
// gman was here
}
private:
complex_type mValue;
};
}
#endif
Taken from Stack Overflow, recommended by Bjarne Stroustrup creator of in the book The C++ Programming Language
.
Shrink/Expand select
Shift+Alt+RightArrow
selects between brackets.Fold/Unfold
Control+K,Control+0
Control+Shift+'
Control+Shift+¿
expands or collapse region.Goto Definition
F12
Control+Click
goes to the definition.Format Document
Shift+Alt+f
formats the document.Switch Header/Source
Alt+O
switchs between <header>.h and <source>.cpp files.Back
Alt+LeftArrow
back position.Control+Shift+M
Open problems.Control+Shift+D
Open debug.Control+�
Open terminal.Control+K,Control+S
opens keyboard shortcuts.Control+K,Control+R
Opens Keyboard Reference
Control+Windows+Alt+K
view bookmarks explorer.Control+Alt+K
toggle bookmark.Control+Alt+(J|L)
previous/next bookmark.
unresolved externals
signature between header and source files does not match orextern
variable in the header file no set in the source file.
- Why there is not a single vscode extension to save or group breakpoints?