2017-08-09 7 views
0

私はmakefileを使ってビルドする既存のコードベースを持っており、Visual Studioコードを使ってそれを実行したいと思っています。 launch.jsonとtasks.jsonがあります。vsコードを実行するコード

{ 
"version": "0.2.0", 
"configurations": [{ 
    "name": "C Launch (GDB)", 
    "type": "cppdbg", 
    "request": "launch", 
    "launchOptionType": "Local", 
    "targetArchitecture": "x64",   
    "cwd": "${workspaceRoot}", 
    "program": "E:/code/c", 
    "miDebuggerPath": "E:/Program Files/TDM-GCC-64/bin/gdb64.exe", 
    "args": [""], 
    "stopAtEntry": false, 
    "externalConsole": true, 
    "preLaunchTask": "gcc"   
}] 
} 


{ 
"version": "0.1.0", 
"command": "gcc", 
"args": ["${file}", "-o", "${fileBasenameNoExtension}.exe", "-g3", "-Og", "-Wall", "-static-libgcc", "-std=c11", "-fexec-charset=GBK", "-finput-charset=UTF-8"], 
"showOutput": "always", 
"problemMatcher": { 
    "owner": "c", 
    "fileLocation": ["relative", "${workspaceRoot}"], 
    "pattern": { 
     "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", 
     "file": 1, 
     "line": 2, 
     "column": 3, 
     "severity": 4, 
     "message": 5 
    } 
} 
} 

次に、Hello worldを実行すると、いくつかの問題が発生します。

enter image description here

答えて

1

Windows上\の代わり/を使用するようにパスを変更してみてください。あなたはJSON文字列で\をエスケープする必要があるため、実際の値は、次のようになります。プログラム:

"program": "E:\\code\\c\\${fileBasenameNoExtension}.exe" 

は、構築された実行可能ファイルを提供し、私はit.Butが、問題はまだexist.`launchように思わましE:\code\c

+0

で実際にあります'E:\ code \ c'が存在しません。 ' – Maxis

+0

ディスクを見ると、そのパスに実行可能ファイルがありますか?値が '' E:\\ code \\ c.exe ''になるように' .exe'を追加するとどうなりますか? –

+0

'E:\\ code \\ c \\ $ {fileBasenameNoExtension} .exe' – Maxis

関連する問題