На курсах backend по C++
Что делать после установки Ubuntu 18.04
sudo apt update
sudo apt -y install git
скачать vs code https://code.visualstudio.com/docs/?dv=linux64_deb
Установить расширения (extensions)
Python 2018.10.1
C/C++ 0.20.1
Перезапустить vs code
sudo apt install -y clang-6.0
sudo ln -s /usr/bin/clang++-6.0 /usr/bin/clang++
sudo ln -s /usr/bin/clang-6.0 /usr/bin/clang
sudo apt install -y make
sudo apt install -y cmake
sudo apt install -y python3-pip
sudo pip3 install conan
Прописать в файл ~/.conan/profiles/default
[settings]
os=Linux
os_build=Linux
arch=x86_64
arch_build=x86_64
compiler=clang
compiler.version=6.0
compiler.libcxx=libc++
build_type=Release
[options]
[build_requires]
[env]
CC=clang
CXX=clang++
Возможно, для сборки потребуется доустановить пакеты libc++-dev
и libc++abi-dev
.
Если cmake валится
cmake ..
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Current conanbuildinfo.cmake directory: /home/user/c++/meeting_backend/build
CMake Error at build/conanbuildinfo.cmake:487 (message):
Incorrect 'clang', is not the one detected by CMake: 'GNU'
Call Stack (most recent call first):
build/conanbuildinfo.cmake:120 (conan_check_compiler)
CMakeLists.txt:7 (conan_basic_setup)
-- Configuring incomplete, errors occurred!
See also "/home/user/c++/meeting_backend/build/CMakeFiles/CMakeOutput.log".
То следует выполнить команды:
export CXX=clang++
export CC=clang
И добавить в файл используемой оболочки, например ~/.bashrc
или ~/.zshrc
VS Code include path problem
В секцию includePath
файла .vscode/c_cpp_properties.json
добавить ~/.conan/data/**
.
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"~/.conan/data/**"
],
"defines": [],
"compilerPath": "/usr/bin/clang",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64"
}
],
"version": 4
}