F
Fredrik.y
Guest
Sorry if I selected the wrong forum.
I am working inside a CMake project and is building the project inside a docker container running ubuntu. I get a lot of Intellisense errors because the headers are not available in the host machine, so I have copied them from the build container to the host machine. More specifically into C:\build_machine_include. I am using the following CppProperties.json file:
{
"configurations": [
{
"name": "Target-Debug",
"includePath": [ "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\IDE\\VC\\Linux\\include\\usr\\include", "C:\\build_machine_include", "${workspaceRoot}/**" ],
"intelliSenseMode": "linux-gcc-x64",
"compilerSwitches": "/std:c++17"
},
{
"name": "Target-Release",
"includePath": [ "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\IDE\\VC\\Linux\\include\\usr\\include", "C:\\build_machine_include", "${workspaceRoot}/**" ],
"intelliSenseMode": "linux-gcc-x64",
"compilerSwitches": "/std:c++17"
}
]
}
If I open up my project and let the CMake cache generation and extraction finish I still get the Intellisense errors, however if I cancel the generation, either by pressing 'Settings' or 'Cancel' in the bar above the source code, Intellisense manages to find the files in C:\build_machine_include, helps me autocomplete and even the Call Hierarchy feature works properly. If I then generate CMake again, the Intellisense functionality works in already opened files but if I open other files or close and reopen I get the Intellisense Errors again. If I generate CMake cache again and cancel it, Intellisense starts working again.
There is only hiccup when using this workaround. I get intellisense errors in my code where C++11 features such as nullptr and std::unique_ptr is used. Also it is not possible to build unless CMake cache is generated.
Here is part of my CMakeSettings:
... "configurations": [
{
"name": "Target-Release",
"generator": "Ninja",
"remoteMachineName": "${env.BUILD_MACHINE}",
"configurationType": "Debug",
"remoteCMakeListsRoot": "${env.REMOTE_DIR}/src",
"cmakeExecutable": "/usr/bin/cmake",
"buildRoot": "${env.LOCALAPPDATA}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
"remoteBuildRoot": "${env.REMOTE_DIR}/build/Target_release",
"remoteCopySources": true,
"remoteCopySourcesOutputVerbosity": "Normal",
"remoteCopySourcesConcurrentCopies": "${env.CONCURRENT_COPIES}",
"cmakeCommandArgs": "",
"variables": [
{
"name": "CMAKE_TOOLCHAIN_FILE",
"value": "${env.REMOTE_DIR}/cmake/Toolchain_target.cmake"
}
],
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "linux-arm" ]
}...
Is this issue caused by a configuration mistake on my part or is there a better workaround available?
Is there any way to enable C++11 in Intellisense?
Thanks!
Continue reading...
I am working inside a CMake project and is building the project inside a docker container running ubuntu. I get a lot of Intellisense errors because the headers are not available in the host machine, so I have copied them from the build container to the host machine. More specifically into C:\build_machine_include. I am using the following CppProperties.json file:
{
"configurations": [
{
"name": "Target-Debug",
"includePath": [ "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\IDE\\VC\\Linux\\include\\usr\\include", "C:\\build_machine_include", "${workspaceRoot}/**" ],
"intelliSenseMode": "linux-gcc-x64",
"compilerSwitches": "/std:c++17"
},
{
"name": "Target-Release",
"includePath": [ "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\IDE\\VC\\Linux\\include\\usr\\include", "C:\\build_machine_include", "${workspaceRoot}/**" ],
"intelliSenseMode": "linux-gcc-x64",
"compilerSwitches": "/std:c++17"
}
]
}
If I open up my project and let the CMake cache generation and extraction finish I still get the Intellisense errors, however if I cancel the generation, either by pressing 'Settings' or 'Cancel' in the bar above the source code, Intellisense manages to find the files in C:\build_machine_include, helps me autocomplete and even the Call Hierarchy feature works properly. If I then generate CMake again, the Intellisense functionality works in already opened files but if I open other files or close and reopen I get the Intellisense Errors again. If I generate CMake cache again and cancel it, Intellisense starts working again.
There is only hiccup when using this workaround. I get intellisense errors in my code where C++11 features such as nullptr and std::unique_ptr is used. Also it is not possible to build unless CMake cache is generated.
Here is part of my CMakeSettings:
... "configurations": [
{
"name": "Target-Release",
"generator": "Ninja",
"remoteMachineName": "${env.BUILD_MACHINE}",
"configurationType": "Debug",
"remoteCMakeListsRoot": "${env.REMOTE_DIR}/src",
"cmakeExecutable": "/usr/bin/cmake",
"buildRoot": "${env.LOCALAPPDATA}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
"remoteBuildRoot": "${env.REMOTE_DIR}/build/Target_release",
"remoteCopySources": true,
"remoteCopySourcesOutputVerbosity": "Normal",
"remoteCopySourcesConcurrentCopies": "${env.CONCURRENT_COPIES}",
"cmakeCommandArgs": "",
"variables": [
{
"name": "CMAKE_TOOLCHAIN_FILE",
"value": "${env.REMOTE_DIR}/cmake/Toolchain_target.cmake"
}
],
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "linux-arm" ]
}...
Is this issue caused by a configuration mistake on my part or is there a better workaround available?
Is there any way to enable C++11 in Intellisense?
Thanks!
Continue reading...