반응형
    
    
    
  1. 오류발생
{
    "label": "save and compile for C",
    "command": "gcc",
    "args": [
        "${file}",
        "-o",
        "${fileDirname}/${fileBasenameNoExtension}"
    ],
    "group": "build",
    "problemMatcher": {
        "fileLocation": [
            "relative",
            "${workspaceRoot}"
        ],
        "pattern": {
            "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning error):\\s+(.*)$",
            "file": 1,
            "line": 2,
            "column": 3,
            "severity": 4,
            "message": 5
        }
    }
},
{
    "label": "execute",
    "command": "cmd",
    "group": "test",
    "args": [
        "/C",
        "${fileDirname}\\${fileBasenameNoExtension}"
    ]
}
컴파일러 실행 후
gcc.exe: error: C:UsersKangDesktoptesthelloworld.c: No such file or directory 
gcc.exe: fatal error: no input files 
compilation terminated.
에러가 발생함
2. 해결방안
{
    "label": "save and compile for C",
    "command": "gcc",
    "args": [
        "'${file}'",
        "-o",
        "'${fileDirname}/${fileBasenameNoExtension}'"
    ],
    "group": {
        "kind": "test",
        "isDefault": true
    },
    "problemMatcher": {
        "fileLocation": [
            "relative",
            "${workspaceRoot}"
        ],
        "pattern": {
            "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning error):\\s+(.*)$",
            "file": 1,
            "line": 2,
            "column": 3,
            "severity": 4,
            "message": 5
        }
    }
},
{
    "label": "execute",
    "command": "",
    "group": "build",
    "args": [
    //	"/C",
        "'${fileDirname}\\${fileBasenameNoExtension}.exe'"
    ],
    "problemMatcher": []
}
원인은 gitbash에서 \\와 .exe파일을 인식을 하지 못해 발생하는 에러
파일 경로를 작은 따옴표로 감싸주고 excute파일 경로 마지막에.exe를 넣어 실행함
반응형
    
    
    
   
                    
                  