setting up your development environment - pisanorg/w GitHub Wiki
Setting up your Development Environment
Setting up your development environment is not a quick task, but if done right it can save you hundreds of hours.
My preferred development environment for C++ is CLion running on Mac. I have also included details of my Windows development environment since lots of people use Windows. Visual Studio, Eclipse and other IDEs have similar features to CLion, so modify the instructions as needed to get the same functionality.
Msys2 (Windows)
CLion relies on external programs for compilation which means you need to have g++ and gcc already installed. There are multiple options (MinGw, Cygwin, etc) but my preferred one is Msys2 which provides a Unix like environment under Windows. It also helps install additional programs easily.
MSYS2 is normally installed in C:\msys64\ and only uses that directory, so you can delete the directory and restart if needed. It does not touch any other files or directories under windows.
- Right Click on
Start > System > Searchfor View Advanced System Settings > Environment Variables, Add new user variable HOME with %USERPROFILE% - this will make Msys2 start in the windows directory (if you do this after installing Msys2, move files from C:\msys64\home\pisan to C:\Users\pisan manually https://github.com/valtron/llvm-stuff/wiki/Set-up-Windows-dev-environment-with-MSYS2
2. Install MSYS2 from https://www.msys2.org/ (the msys2-x86_64.exe version) Follow the instructions on the page to make sure all the packages are updated.
- Using the MSYS2 terminal, install g++ and related packages (~2GB to download so make sure you have a fast internet connection)
pacman -S --needed base-devel mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain mingw-w64-i686-cmake mingw-w64-x86_64-cmake
At this point you should be able to execute g++ --version to confirm the compiler is installed and you can setup CLion.

- (Optional)
clang++is a newer compiler that works faster thang++. Install it using
pacman -S --needed mingw-w64-x86_64-clang mingw-w64-x86_64-clang-analyzer mingw-w64-x86_64-clang-tools-extra mingw-w64-x86_64-lldb mingw-w64-x86_64-llvm
At this point you should be able to execute clang++ --version to confirm the compiler is installed

- (Optional) If you are planning to use GitHub, install the git executable for MSYS2 environment
pacman -S --needed git
-
Run
c:\msys64\mingw64.exeto get started and pin it to the taskbar for future -
If the above instructions have not worked for you can download a copy of my
C:\msys64directory. It is large and no guarantee that it will work on your machine (and you should not normally download executables from web pages), but it is provided as a last resort. msys64-gcc-large-20190927.zip
Mac
Mac relies on Xcode for compilers or you can install g++ and gcc via brew
- Install Xcode -- we need it for the command line tools
- Start XCode and agree to Terms and Conditions
- Open terminal use: "xcode-select --install" This will install comman-line interface (CLI)
- Install homebrew
- if using 10.12 or lower (as of Jan 2020, valgrind may get updated). You can Open terminal use:
brew install valgrind gcc make cmake emacs gdb wget python3There is also tutorial on how to fix Valgrind on MacOS 10.13 and higher at https://www.gungorbudak.com/blog/2018/04/28/how-to-install-valgrind-on-macos-high-sierra/
CLion
Install CLion, assuming Msys2 has already been set as above for Windows or necessary programs installed for Mac Settings > Editor > Live Templates > CMake -- create a new shortcut named "wall" as follows
# CSS Linux Lab only has cmake 3.5
cmake_minimum_required(VERSION 3.5)
# Minimum c++14
set(CMAKE_CXX_STANDARD 14)
# have compiler give warnings, but not for signed/unsigned
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wextra -Wno-sign-compare")
- Add Ctrl-R as a Clion shortcut for Run
- Ctrl-I as Auto-Indent Lines (instead or in addition to Ctrl-Alt-I)
- Check that you can use different toolchains
- g++ or clang++ for regular Windows development
- Visual Studio's compiler -- if necessary
- If you are using GitHub Install Github Desktop from https://desktop.github.com/ Download gitignore for JetBrains.CLion from https://github.com/github/gitignore/tree/master/Global and save it to ~/.gitignore_global
File > Settings > Plugins -- enable GitHub and Git Integration plugins
File > Settings > Version Control > GitHub -- add your github account
Confirm that Using VCS menu option, files can be committed and pushed to repository