Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio code 如何使用GnuCOBOL编译_Visual Studio Code_Vscode Settings_Gnucobol - Fatal编程技术网

Visual studio code 如何使用GnuCOBOL编译

Visual studio code 如何使用GnuCOBOL编译,visual-studio-code,vscode-settings,gnucobol,Visual Studio Code,Vscode Settings,Gnucobol,我试图添加一个任务来编译一个程序,但在设置环境变量时遇到了困难。我有这个: { // See https://go.microsoft.com/fwlink LinkId=733558 // for the documentation about the tasks.json format "version": "2.0.0", "label": "GnuCOBOL - Compile (single file)", "type": "shell", "option

我试图添加一个任务来编译一个程序,但在设置环境变量时遇到了困难。我有这个:

{
  // See https://go.microsoft.com/fwlink LinkId=733558
  // for the documentation about the tasks.json format
  "version": "2.0.0",
   "label": "GnuCOBOL - Compile (single file)",
   "type": "shell",
   "options": {
    "env": {
        "PATH=c:\\gnucobol3\\bin"
        "COB_CONFIG_DIR=c:\\gnucobol3\\config"
        "COB_COPY_DIR=c:\\gnucobol3\\copy"
        "COB_INCLUDE_PATH=c:\\gnucobol3\\include"
        "COB_LIB_PATH=c:\\gnucobol3\\lib"
       },
    "command": "cobc",
    "args": [
      "-x",
      "-std=mf",
      "-tPROG.LST",
      "BBCB.CBL"
      ]
    },
} 
env条目下面都有曲线,并显示错误“预期为冒号”


我非常感谢你的帮助。谢谢。

文件路径适用于基于Windows的操作系统(
c:\…
)。如果您使用的是Linux,这些是不正确的

这种格式是JSON

“env”:{…}
采用键:值对(由大括号决定),因此您需要:

"PATH": "c:\\gnucobol3\\bin",
冒号(
)分隔键和值,逗号(
)分隔键:值对

不确定是否需要转义文件路径
\\
,或仅转义
\

NB
“args”:[…]
采用字符串值数组(由方括号确定),这就是它与
“env”
不同的原因

env条目下面都有曲线,并显示错误“预期为冒号”

因为它需要一个包含的列表,该列表中应该有冒号,并使用逗号分隔(与
options
变量相同)[注意:这实际上是一个json问题,使用该标记可能是合理的]。 看

另外,您的脚本有一些硬连接的文件名(这是特定于vscode的),您可能希望使用

未经测试的结果:

{
  // See https://go.microsoft.com/fwlink LinkId=733558
  // for the documentation about the tasks.json format
  "version": "2.0.0",
   "label": "GnuCOBOL - Compile (single file)",
   "type": "shell",
   "options": {
    "env": {
        "PATH": "c:\\gnucobol3\\bin",
        "COB_CONFIG_DIR": "c:\\gnucobol3\\config",
        "COB_COPY_DIR": "c:\\gnucobol3\\copy",
        "COB_INCLUDE_PATH": "c:\\gnucobol3\\include",
        "COB_LIB_PATH": "c:\\gnucobol3\\lib",
       },
    "command": "cobc",
    "args": [
      "-x",
      "-std=mf",
      "-t${fileBasenameNoExtension}.LST",
      "${file}"
      ]
    },
} 

达斯:谢谢。我不熟悉.JSON,因此我试图定义一个任务的尝试很少。我已经按照您的建议修改了tasks.json,不再有曲线:-)不用担心!在某种程度上,这对我们所有人来说都是新的。它是一种广泛使用的格式,因此您可能会再次遇到它。“没有扭曲的线条”很好,但是——同样重要的是——您的代码现在可以编译了吗?Daz:是的,但是我需要更多关于tasks.json结构的帮助。西蒙:谢谢。当我整理好错误后,我打算尝试“概括”任务。请参阅上面的帖子。@paoloricardo确保您将答案标记为“解决方案”(=对您有效的答案),并对任何有帮助的答案进行投票。注意:对于“更多信息”,我强烈建议查看我链接的文档…请重新检查答案,投票选出任何“有用”的答案,并接受对您有用的任何内容。如果您的原始问题没有得到回答,请在答案上留下评论。谢谢。