Code able to compile, but not executing, ie output not showing in debug window, breakpoints are not hit. Same configuration was working on non M1 Mac
Task.json:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "clang++ build active file",
"command": "/usr/bin/clang++",
"args": [
"-std=c++17",
"-stdlib=libc++",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": ["$gcc"],
"group": {
"kind": "build",
"isDefault": 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": "clang++ - Build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
"stopAtEntry": true,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "lldb",
"preLaunchTask": "C/C++: clang++ build active file"
}
]
}
cp_properties.json
{
"configurations": [
{
"name": "Mac",
"includePath": ["${workspaceFolder}/**"],
"defines": [],
"macFrameworkPath": [
"/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks"
],
"compilerPath": "/usr/bin/clang",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64"
}
],
"version": 4
}
Terminal Output:
Starting build...
/usr/bin/clang++ -fdiagnostics-color=always -g
/Users/gyan/workplace/vscode/test/test.cpp -o /Users/gyan/workplace/vscode/test/test
Build finished successfully.
Terminal will be reused by tasks, press any key to close it.
test.cpp:
#include <iostream>
#include <sstream>
using namespace std;
int main(){
string s = "my name is Gyan p\n";
istringstream iss(s);
string word;
cout<<"s";
while(iss >> word){
cout<<word<<" ";
}
return 0;
}
Not getting any idea of the issue
I fixed it using following config changes in launch.json
:
"-arch", "x86_64",
"targetArchitecture": "x86_64",
"osx": {
"preLaunchTask": "C/C++: g++ build active file",
"MIMode": "lldb"
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.