Cmake installation:
sudo apt-get install cmake
Complie .c file in ubuntu:
gedit <abc>.c
remove folders (directory):
https://askubuntu.com/questions/217893/how-to-delete-a-non-empty-directory-in-terminal
install wechat:
http://ubuntuhandbook.org/index.php/2017/07/install-wechat-desktop-app-ubuntu-16-04-higher/
Create .sh file:
https://www.youtube.com/watch?v=He-5BpUGSag
vi <abc>.sh
Copy a file to another directory:
cp or mv
example:
cp backup/cmake/t1/main.c backup/cmake/t2
copies main.c from folder t1 to foder t2
if they are in the same folder, you can also do:
mv main.c src
Create a .txt file:
Method 1:
nano <abc>.txt
Method 2:
vi <abc>.txt then press i to start editing the file (entering the editing mode), and press Esc when finished. After going back to the viewing mode, type :w to save and :q to quit.
Create python virtual environment in ubuntu:
mkdir pyenvs
cd pyenvs
python3 -m venv my_env
source my_env/bin/activate
…
nano hello.py
python hello.py
…
deactivate
Install python idle on Ubuntu:
sudo apt-get install idle3
when using it:
idle3 <filename>.py
GPU Replacement:
https://askubuntu.com/questions/620693/what-driver-should-i-choose-for-my-nvidia-gpu
https://ubuntuforums.org/showthread.php?t=2334268
https://www.linuxbabe.com/desktop-linux/switch-intel-nvidia-graphics-card-ubuntu
https://ubuntu-mate.community/t/how-to-install-graphics-card-drivers-in-ubuntu/3228/2
tf.mul problem:
tf.mul, tf.sub and tf.neg are deprecated in favor of tf.multiply, tf.subtract and tf.negative.
Complie C file:
gedit hello.c
… (write contents in hello.c)
gcc -o hello hello.c
./hello
Install tar.gz package:
unzip to where you want to install - {address}
cd {address}
cd bin
./xx.sh
Download sth from github to local:
git clone https://github.com/xxxx
Use vim:
touch main.cpp
vim main.cpp
(inside vim) press i to enter the insert mode
(insert mode) edit, …, exit by press Esc
(inside vim) :wq //write and quit
Check file contents:
cat main.cpp
Create cmake - Use CMake to manage a project:
Method 1 (easy but messy):
touch CMakeLists.txt
vim CMakeLists.txt
project(helloSLAM)
add_executable( sayHello main.cpp)
cmake .
make
./sayHello
Method 2 (not messy, put processing files in build, head files in include, source files in src):
mkdir build
mkdir include src
touch include/Hello.h src/Hello.cpp
vim include/Hello.h
(content in Hello.h)
#pragma once
void SayHello();
vim src/Hello.cpp
(content in Hello.cpp)
#include "Hello.h"
#include <iostream>
using namespace std;
void SayHello() {
cout<<"Hello SLAM!"<<endl;
}
vim main.cpp
(content in main.cpp)
#include "Hello.h"
using namespace std;
int main(int argc, char** argv){
SayHello();
return 0;
}
vim CMakeLists.txt
(content in CMakeLists.txt)
project(helloSLAM)
#where we have header files
include_directories( "include" )
#only source files
add_library( libHello src/Hello.cpp )
add_executable( sayHello main.cpp )
target_link_libraries( sayHello libHello )
cd build
cmake ..
make
./sayHello
Method 3 (same as Method 2 except defining a debug mode):
cmake_minimum_required( VERSION 2.8 )
project(helloSLAM)
#specify compile mode to debug
set( CMAKE_BUILD_TYPE Debug )
#where we have header files
include_directories( "include" )
#only source files
add_library( libHello src/Hello.cpp )
add_executable( sayHello main.cpp )
target_link_libraries( sayHello libHello )
Define Env Variable:
https://www.jianshu.com/p/ac2bc0ad3d74
change PS1:
https://askubuntu.com/questions/145618/how-can-i-shorten-my-command-line-bash-prompt
PS1='\u:\W\$ '
Install OpenGL:
sudo apt-get update
sudo apt-get install freeglut3-dev
Install glew:
sudo apt-get install libglew-dev
Install Pangolin: