Skip to content

Instantly share code, notes, and snippets.

@savolla
Last active June 23, 2018 15:45
Show Gist options
  • Save savolla/f448930469d706bdcc8ac6a1d49107fa to your computer and use it in GitHub Desktop.
Save savolla/f448930469d706bdcc8ac6a1d49107fa to your computer and use it in GitHub Desktop.

C ++ Development Environment Setup for Arch Linux


Note: This Text Tutorial has extracted from this video.

Author: savolla

Source: TheChernoProject

Install These Programs First

  • vim

  • g++

  • codeline

  • cmake

    sudo pacman -S vim g++ cmake aurman -S codeline # compilation may be a bit slow with makepkg

Create Project File

mkdir helloWorld
cd helloWorld
mkdir src
touch src/Main.cpp
chmod 755 src/Main.cpp

Make a Build Script file (To auto generate necessary files)


1. Create a cmake file first

vim CMakeLists.txt

2. Type the following

cmake_minimum_required (VERSION 3.5)
project (HelloWorld)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -std=c++14")
set (source_dir "${PROJECT_SOURCE_DIR}/src/")
file (GLOB source_files "${source_dir}/*.cpp")
add_executable (HelloWorld ${source_files})

3. write and quit. let's create a bash script this script will actually use CMakeLists.txt file to generate our files

touch build.sh    # create the file
chmod +x build.sh # make it executable

4. Type the following into this file

#!/bin/bash
cmake -G "CodeLite - Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug

5. Write and quit. Then run the script.

./build.sh

6. After you run the script you will see there are bunch of new files created in the helloWorld directory. The most important files are;

  • HelloWorld.project
  • HelloWorld.workspace

now you can open HelloWorld.workspace file with codelite and start coding

codelite HelloWorld.workspace & // we used & to send the process to background

HAPPY CODING!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment