Skip to content

Instantly share code, notes, and snippets.

@treastrain
Created October 27, 2020 10:42
Show Gist options
  • Save treastrain/f822c5e6f6a1b35dbf88f69fde83dad3 to your computer and use it in GitHub Desktop.
Save treastrain/f822c5e6f6a1b35dbf88f69fde83dad3 to your computer and use it in GitHub Desktop.
Visual Studio Code から SSH 接続した Raspberry Pi 4 Model B で OpenCV を含む C++ プロジェクトを作成した際の各 json ファイル
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/usr/local/include/opencv4"
],
"defines": [],
"compilerPath": "/usr/bin/clang",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "clang-arm"
}
],
"version": 4
}
{
// IntelliSense を使用して利用可能な属性を学べます。
// 既存の属性の説明をホバーして表示します。
// 詳細情報は次を確認してください: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "clang++ - アクティブ ファイルのビルドとデバッグ",
"type": "lldb",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
// "stopAtEntry": true,
"cwd": "${workspaceFolder}",
// "environment": [],
// "externalConsole": false,
// "MIMode": "lldb",
/*
"setupCommands": [
{
"description": "gdb の再フォーマットを有効にする",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
*/
"preLaunchTask": "C/C++: clang++ build active file with OpenCV",
// "miDebuggerPath": "/usr/bin/lldb-mi"
}
]
}
#include <iostream>
#include <opencv2/opencv.hpp>
#include <string>
using namespace std;
void printOpenCVVersion() {
cout << "OpenCV version : " << CV_VERSION << endl;
cout << "Major version : " << CV_MAJOR_VERSION << endl;
cout << "Minor version : " << CV_MINOR_VERSION << endl;
cout << "Subminor version : " << CV_SUBMINOR_VERSION << endl;
}
int main(int argc, char* argv[]) {
cout << "Hello, happy world!" << endl;
printOpenCVVersion();
return 0;
}
{
"editor.formatOnSave": true,
"editor.formatOnType": true,
"C_Cpp.clang_format_style": "{BasedOnStyle: Google, IndentWidth: 4, ColumnLimit: 100}",
"files.associations": {
"iostream": "cpp"
}
}
{
"version": "2.0.0",
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: clang++ build active file with OpenCV",
"command": "/usr/bin/clang++",
"args": [
"-std=c++17",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}",
"-I/usr/local/include/opencv4",
"-L/usr/local/lib/opencv4",
"-lopencv_core"
],
"options": {
"cwd": "/usr/bin"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "compiler: /usr/bin/clang++"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment