Download CLion and cmake will be installed simultaneously with CLion
- Uninstall the default version provided by Ubuntu's package manager and configuration by using:
sudo apt remove --purge --auto-remove cmake
- Go to the official CMake webpage (http://www.cmake.org/download), then download and extract the latest version. Update the version and build variables in the following command to get the desired version:
build=4
mkdir ~/temp
cd ~/temp
wget https://cmake.org/files/v$version/cmake-$version.$build.tar.gz
tar -xzvf cmake-$version.$build.tar.gz
cd cmake-$version.$build/
- Install the extracted source by running:
make -j$(nproc)
sudo make install
- Test your new cmake version:
cmake --version
- Usually paths make/c/c++:
make:
/usr/bin/make
C Compiler:/usr/bin/cc
C++ Compiler:/usr/bin/c++
-
Go to Settings / Preferences | Build, Execution, Deployment | Toolchains and click plus icon to create a new toolchain
-
Select Remote Host from the drop-down menu and click icons actions menu in the Credentials field. In the dialog that opens, provide the credentials for accessing you remote machine:
- After establishing the connection, CLion attempts to detect the tools in default remote locations /usr/bin/cmake and /usr/bin/gdb (or using the full paths, if you have provided manually). When the checks finish successfully, the toolchain is ready for use:
4.(optional) You can make the newly created toolchain the default one (for this, move it to the top of the toolchains list by clicking move upmove down). When set as default, the remote toolchain is used for all the projects you create and open in CLion.
- Go to Settings / Preferences | Build, Execution, Deployment | CMake, click plus icon to create a new CMake profile, and connect it to your remote toolchain using the Toolchain field:
-
Check and adjust the deployment configuration (i.e remote host window)
-
Once you've done you will be able to choose local/remote here:
Source: https://www.jetbrains.com/help/clion/remote-projects-support.html
Source (video): https://youtu.be/g1zPcja3zAU?t=658
file main.cpp
prints out host name and local IP, example of print:
Hostname: instance-3
Host IP: 10.128.0.2
sudo apt update
sudo apt install build-essential
sudo apt-get install manpages-dev
gcc --version
mkdir cpp_ex
cd cpp_ex
vim hello.cpp
(takebase_ex/hello.cpp
from this repo)sudo g++ hello.cpp
./a.out
Source: https://github.com/ipkn/crow Source: https://github.com/ipkn/crow/wiki/Installation
- Download and include file: https://github.com/ipkn/crow/releases/download/v0.1/crow_all.h (or take it from this repo
crow.h
) - If you try to run
sudo g++ hello_crow.cpp
(take it from this repobase_ex/hello_crow.cpp
) you will see "fatal error: boost/optional.hpp: No such file or directory" => need to install dependecies sudo apt install libboost-all-dev libssl-dev
sudo g++ crw_server.cpp -lboost_system -pthread
or if it does not run theng++ -O3 -std=c++11 server.cpp -lboost_thread -lboost_system -pthread
./a.out
curl -X GET http://localhost:18080/hi
In order to do more advanced example and pass some parameters inside (list/double/int/string) and to return full json:
cd advanced_crow
(take it from this repo)sudo g++ crw_server.cpp -lboost_system -pthread
./a.out
- Example to pass inside string/int/double/list parameters:
curl -X GET "http://localhost:18080/ex_json?foo='blabla'&pew=32&count[]=a&count[]=b&double_param=2.31"
- Just another example:
curl -X GET "http://localhost:18080/ex_json_arr"
Source and more examples: https://github.com/ART-Robot-Release/arobot/blob/1a9a1ea31ea6ccbc206b0b38737588894611f16c/src/robot_control/core/database/src/crow_server.cpp
Install Docker: https://docs.docker.com/engine/install/ubuntu/
- Clone this repo and go to
helloworld_docker
folder sudo docker build --rm -f Dockerfile -t dockerhello:latest .
sudo docker run --rm -it dockerhello:latest
Source: https://devblogs.microsoft.com/cppblog/c-development-with-docker-containers-in-visual-studio-code/
- Clone this repo and go to
crow_docker
fodler sudo docker build --rm -f Dockerfile -t crowdocker:latest .
sudo docker run -p 300:18080 --rm -it crowdocker:latest
(match port 300 to 18080)curl -X GET http://localhost:300/hi