H8,SH,マイコン,ぼやき川柳,ダウンロード

BuildはTerminalから !??


何回も「Run and Debug」してるのに、どうもコンパイルエラーが出ないな〜〜〜っと思っていたら、

Buildは「Terminal」->「Run Build Task」(Ctrl + Shift + B)だって、普通RunしたらBuildもするだろう

XCODEは使いやすかった。makeでさえソース修正すると自動でBuildしてくれるのに



 
 

 
 
 

tasks.json


 雛形のままでは動かない
「"cwd": "${workspaceFolder}" // 作業ディレクトリ」が必要

ソースファイルがnot foundになる

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: g++.exe build active file",
            "command": "C:\\gcc\\mingw64\\bin\\g++.exe",
            "args": [
                "painter.cpp",
                "mock_unittest.cpp",
                "-fdiagnostics-color=always",
//              "-g -pthread",
                "-lgtest_main",
                "-lgtest",
                "-lgmock",
//                "${file}",
                "-o",
                "${workspaceFolder}\\test.exe"
            ],
            "options": {
                "cwd": "${workspaceFolder}" // 作業ディレクトリ
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}
 
GoogletestでMockを使う場合は、「"-lgmock",」を忘れないように。エラーが大量に出てくる
 
 

settings.json


 あ

{
    "C_Cpp.errorSquiggles": "enabled",

    "editor.tokenColorCustomizations": {
        "textMateRules": [
            {
                "scope": "googletest.failed",
                "settings": {
                    "foreground": "#f00"
                }
            },
            {
                "scope": "googletest.passed",
                "settings": {
                    "foreground": "#0f0"
                }
            },
            {
                "scope": "googletest.run",
                "settings": {
                    "foreground": "#0f0"
                }
            }
        ]
    },
    "gtest-adapter.debugConfig": "Debug",
    "gtest-adapter.supportLocation": true
}
 

 

launch.json


 あ

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/test.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "miDebuggerPath": "C:/gcc/mingw64/bin/gdb.exe",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "Set Disassembly Flavor to Intel",
                    "text": "-gdb-set disassembly-flavor intel",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}
 

 
  

ムカつく!(愚痴)


 
 
 
 
 
 
 
 
 
 

コメントをかく


「http://」を含む投稿は禁止されています。

利用規約をご確認のうえご記入下さい

Menu

管理人/副管理人のみ編集できます