Vscode-cpptools: substitution: ${env.XXX} not supported in c_cpp_properties.json

Created on 26 May 2017  路  7Comments  路  Source: microsoft/vscode-cpptools

Not like in tasks.json

Language Service duplicate

Most helpful comment

The docs are from the VS Code team. Our extension supports the different syntax...maybe we should change it to use the ${env.} syntax instead to avoid confusion and conflict with other special variables like ${workspaceRoot}.

All 7 comments

${ENV} is supported with includePath and browse.path. Is that okay, or did you want the ${env.ENV} syntax to work or for environment variables to work on other properties.

Environment

os: Windows 10
vscode version: 1.12.2
extension version: 0.11.2

Case

file a.cpp:

#include <jni.h>
...

c_cpp_properties.json

        {
            "name": "Win32",
            "includePath": [
                "${env.JAVA_HOME}/include",
                "${env.JAVA_HOME}/include/win32"
            ],
            "browse": {
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": "",
                "path": [
                    "${env.JAVA_HOME}/include",
                    "${env.JAVA_HOME}/include/win32"
                ]
            }

Result

  • Go To Definition works fine just now when cursor on line #include <jni.h>
  • But there was a red line under source line with tip says 'cannot open source file "jni.h"'

If replace ${env.JAVA_HOME} with absolute path like "C:/Program Files/Java/jdk1.8.0_77, red line gone.

Can you try ${JAVA_HOME}?

${JAVA_HOME} has no problem.
Maybe the document need update.

The docs are from the VS Code team. Our extension supports the different syntax...maybe we should change it to use the ${env.} syntax instead to avoid confusion and conflict with other special variables like ${workspaceRoot}.

Was this page helpful?
0 / 5 - 0 ratings