Setting the 'outDir' attribute in Visual Studio Code

吃可爱长大的小学妹 提交于 2020-01-14 13:28:08

问题


I continue to get this error when I attempt to debug a C++ program: can't launch program 'c:\Users\'my username'\Desktop\C++\'; setting the 'outDir' attribute might help

I have tried various combinations of syntax so that it would satisfy the condition, but I have had no success. I have spent hours trying to find the proper syntax and I have no idea what my problem is. I have had success with running JavaScript applications but they don't seem to require Source maps or the outDir field to be filled. I have the latest version of Visual Studio Code which is 0.7.10 and I have node downloaded and it seems to work fine. Here is a screenshot so you can get an idea of what I'm seeing. http://i.imgur.com/wIcVoQz.png


回答1:


The VSCode message Cannot launch program ... setting the 'outDir' attribute might help can be somewhat misleading, even as recently as VSCode v1.12.2. I would take it with a grain of salt, it seems to simply mean there was a problem launching the application.

In my case, it was caused by a minor error in my launch.json file. I had:

        "type": "node",
        "request": "launch",
        "name": "Gulp",
        "program": "${workspaceRoot}/node_modules/gulp/bin",
        "sourceMaps": true,
        "outFiles": [
            "${workspaceRoot}/{lib,node_modules}/**/*.js",
            "!${workspaceRoot}/lib/tests/**/*.js"
        ]

I fixed it by changing one line:

        "program": "${workspaceRoot}/node_modules/gulp/bin/gulp",

Despite the message's attempt to be helpful, the outFiles property may not be necessary or helpful. Once I fixed the other problem, debugging seems to work fine without it.

Filed as a vscode issue 6/8/2017




回答2:


Only node and mono debugging are supported currently in VSCode. You should set the type in launch.json depending on what you want to debug. More details can be found here: https://code.visualstudio.com/Docs/editor/debugging

You get a weird error because you have sourceMaps: true in your launch.json.



来源:https://stackoverflow.com/questions/32162969/setting-the-outdir-attribute-in-visual-studio-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!