前提・実現したいこと
C++を始めたばかりの初心者です。Visual Studio Codeでデバックをしようとしてあらゆるサイトを見て設定したのですが、ブレイクポイントで止まっても変数やWATCHの欄が空白のままです。そのまま実行していっても然りです。 どうしたら解決しますでしょうか?よろしくお願いします。
【環境】
MacOS (version 10.14.4)
visual studio code(version 1.32.3)
C++(Apple LLVM version 10.0.1 (clang-1001.0.46.3))
以下にlaunch.jsonとtasks.jsonのソースコードを載せておきます。
該当のソースコード
{ // launch.json "version": "0.2.0", "configurations": [ { "name": "(lldb) Launch", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/a.out", "args": [], "stopAtEntry": true, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": true, "MIMode": "lldb" } ] } { // tasks.json "version": "2.0.0", "tasks": [ { "type": "shell", "label": "echo", "command": "g++", "args": [ "-g", "${file}", "-o", "${fileDirname}/${fileBasenameNoExtension}", "-m32" ], "group": { "kind": "build", "isDefault": true }, "options": { "cwd": "/usr/bin" }, "problemMatcher": [ "$gcc" ] } ] } //C++のサンプルコード #include <iostream> #include <cstring> using namespace std; class inventory { char item[40]; int onhand; double cost; public : inventory(char *i, int o,double c){ strcpy(item,i); onhand = o; cost = c; } friend ostream &operator <<(ostream &stream, inventory ob); friend istream &operator >>(istream &stream, inventory &ob); }; ostream &operator<<(ostream &stream, inventory ob){ stream << ob.item << " :在庫数: " << ob.onhand; stream << " 費用は: " << ob.cost << endl; return stream; } istream &operator>>(istream &stream, inventory &ob){ cout << "品名を入力: "; stream >> ob.item; cout << "在庫数を入力: "; stream >> ob.onhand; cout << "原価を入力: "; stream >> ob.cost; return stream; } int main(){ inventory ob("金槌", 4, 12.55); cin >> ob; cout << ob; return 0; }