I am wracking my brain trying to figure out how to have VS Code recognize glib.
#include errors detected. Please update your includePath. Squiggles are disabled for this translation unit (Q:\code\srctext\text_lexer.c).C/C++(1696)
cannot open source file "glibconfig.h" (dependency of "glib-2.0/gmodule.h")C/C++(1696)
I have manually built glib and have the following *.dll and *.pdb files:
gio-2.0-0
glib-2.0-0
gmodule-2.0-0
gobject-2.0-0
gthread-2.0-0
but I do not know if this is necessary to include when vcpkg has it installed?
I have installed glib using vcpkg (Package glib:x86-windows is already installed).
Thanks!
I'm not sure what combination of corrections did the trick, but the errors went away when my c_cpp_properties.json file looked like below.
c_cpp_properties.json
{
"configurations": [
{
"name": "Win32Debug",
"includePath": [
"${workspaceFolder}/include/debug/**",
"C:/sync/name/code/projects/frameworks/projectA/projectA/include/**",
"C:/sync/name/code/libraries/c c++/GTK/glib/lib/glib-2.0/include",
"C:/sync/name/code/libraries/c c++/GTK/glib/include/glib-2.0"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.18362.0",
"cStandard": "c17",
"cppStandard": "c++20",
"intelliSenseMode": "windows-gcc-x86",
"browse": {
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": "${default}",
"path": [
"${workspaceFolder}/include/debug/**",
"C:/sync/name/code/projects/frameworks/projectA/projectA/include/debug/**",
"C:/sync/name/code/libraries/c c++/GTK/glib/lib/glib-2.0/include",
"C:/sync/name/code/libraries/c c++/GTK/glib/include/glib-2.0"
]
},
"compilerArgs": [],
"compilerPath": "C:/msys64/mingw64/bin/gcc.exe",
"forcedInclude": [
"${default}"
]
},
{
"name": "Win64Debug",
"includePath": [
"${workspaceFolder}/include/debug/**",
"D:/backup/sync/name/code/projects/frameworks/projectA/projectA/include/debug/**",
"D:/backup/sync/name/code/libraries/c c++/GTK/glib/lib/glib-2.0/include",
"D:/backup/sync/name/code/libraries/c c++/GTK/glib/include/glib-2.0"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.18362.0",
"compilerPath": "C:/msys64/mingw64/bin/gcc.exe",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "linux-gcc-x64",
"compilerArgs": [],
"browse": {
"path": [
"${workspaceFolder}/include/debug/**",
"C:/sync/name/code/projects/frameworks/projectA/projectA/include/debug/**",
"C:/sync/name/code/libraries/c c++/GTK/glib/lib/glib-2.0/include",
"C:/sync/name/code/libraries/c c++/GTK/glib/include/glib-2.0"
],
"limitSymbolsToIncludedHeaders": true
}
}
],
"version": 4
}
Not sure if tasks.json had any influence (frankly Visual Code's inner workings are an opaque impenetrable blob to my attempts at understanding), but just in case:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "C/C++ g++.exe build",
"command": "C:\\msys64\\mingw64\\bin\\g++.exe",
"args": [
"/property:GenerateFullPaths=true",
"/t:build",
"/consoleloggerparameters:NoSummary",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}",
"--include-directory=C:/sync/name/code/libraries/c c++/GTK/glib/lib/**"
],
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"reveal": "silent"
},
"problemMatcher": [
"$gcc"
]
}
]
}
Related
Ever since my MacBook was updated, I am not able to solve this error that says "#include errors detected. Please update your includePath".
Here is my c_cpp_properties.json file.
{
"configurations": [
{
"name": "Mac",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"macFrameworkPath": [],
"compilerPath": "/usr/local/bin/g++",
"cStandard": "gnu17",
"cppStandard": "gnu++14",
"intelliSenseMode": "macos-gcc-x64"
}
],
"version": 4
}
{
"configurations": [
{
"name": "Mac",
"includePath": [
"/usr/local/Cellar/gcc/10.2.0_4/include/c++/10.2.0/x86_64-apple-darwin20"
],
"defines": [],
"macFrameworkPath": [],
"compilerPath": "/usr/local/bin/g++",
"cStandard": "gnu17",
"cppStandard": "gnu++14",
"intelliSenseMode": "macos-gcc-x64"
}
],
"version": 4
}
Try this path
I just installed Visual Studio Code in Ubuntu 18.04 LTS based ElementaryOS 5.1 Hera, and set up the environment for C/C++. Launch.json and tasks.json look all fine but on debugging, the following errors are triggered:
gcc: error: unrecognized command line option ‘--interpreter=mi’
gcc: error: unrecognized command line option ‘--tty=/dev/pts/0’
gcc: fatal error: no input files compilation terminated.
launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "gcc - Build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"console": "externalTerminal",
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "C/C++: gcc build active file",
"miDebuggerPath": "/usr/bin/gcc"
}
]
}
tasks.json
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: gcc build active file",
"command": "/usr/bin/gcc",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
Is there any way to fix this?
I'm trying to debug the helloworld project
#include <stdio.h>
int
main (void)
{
printf ("Hello, world!\n");
return 0;
}
which is built using clang. I use vs-code to take these actions. Here is my task.json file:
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "C/C++: clang.exe build active file",
"command": "C:\\msys64\\mingw64\\bin\\clang.exe",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"group": "build"
}
]
}
As a build task, it works but then with launch.json to debug it seems with no progress. Here is my launch.json` file:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "clang.exe - Build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "lldb",
"miDebuggerPath": "C:\\msys64\\mingw64\\bin\\lldb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "C/C++: clang.exe build active file"
}
]
}
How to set-up debugger under vs-code with the use of clang/lldb?
It got stall within this command
PS C:\c_helloworld> & 'c:\.vscode\extensions\ms-vscode.cpptools-0.30.0-insiders5\debugAdapters\bin\WindowsDebugLauncher.exe' '--stdin=Microsoft-MIEngine-In-2oaooq4b.u01' '--stdout=Microsoft-MIEngine-Out-ojuis1aj.kfb' '--stderr=Microsoft-MIEngine-Error-tcxqgdhj.tgp' '--pid=Microsoft-MIEngine-Pid-nam4qmgr.r4y' '--dbgExe=C:\msys64\mingw64\bin\lldb.exe' '--interpreter=mi'
I'm trying to debug a main.cpp file that resides in a folder that has spaces in its filename: "Jim and the Skyscrapers".
The error message reads:
Unable to open 'Jim': File not found
And it also gives me the option of creating this "Jim" file.
The debug process works only if I rename the file to "JimAndTheSkyscrapers" so that it doesn't have any spaces.
The way i reference the path in the launch.json and c_cpp_properties.json files is by using the environment variable: ${workspaceFolder}.
As a debugger, I use cygwin's gdb.
I think the problem is: either the debugger parses filepaths in a manner that doesn't allow spaces, either it's a vs code problem. Knowing which one it is would be of great help.
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/a.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [
{"name": "OUTPUT_PATH", "value": "results.txt"}
],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "C:/cygwin64/bin/gdb.exe",
"preLaunchTask": "build",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
c_cpp_properties.json:
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.13.26128/bin/Hostx64/x64/cl.exe",
"cStandard": "c11",
"cppStandard": "c++14",
"intelliSenseMode": "msvc-x64"
}
],
"version": 4
}
In Visual Studio, right-click on a .ts file and "Run JS Tests", only the tests in the .ts file run and are counted in the total.
"Run JS Tests" at the folder level or project level and both the tests in the .ts and .js files are run and counted in the total.
Chutzpah.json settings:
{
"Framework": "jasmine",
"TypeScriptCodeGenTarget": "ES5",
"TestHarnessLocationMode": "SettingsFileAdjacent",
"RootReferencePathMode": "SettingsFileDirectory",
"Compile": {
"Mode": "External",
"Extensions": [ ".ts" ],
"ExtensionsWithNoOutput": [ ".d.ts" ]
},
"Tests": [
{ "Path": "Specs"}
]
}
I had the same issue. All my tests are written in TypeScript, so my *.ts files define what tests exist. I had solved it by including only *.ts files.
{
"Tests": [ { "Path": "Specs", "Includes": [ "*.ts" ] } ],
"Compile": {
"Mode": "External",
"Extensions": [ ".ts" ],
"ExtensionsWithNoOutput": [ ".d.ts" ]
}
}
Works like a charm.
Without seeing your full project it is hard to know for sure but something along the following should help achieve this. If you need to include some .js files you can change the exclude patterns accordingly.
```
{
"Framework": "jasmine",
"TestHarnessLocationMode": "SettingsFileAdjacent",
"RootReferencePathMode": "SettingsFileDirectory",
"Compile": {
"Mode": "External",
"Extensions": [ ".ts" ],
"ExtensionsWithNoOutput": [ ".d.ts" ]
},
"References": [
{ "Excludes": ["*.js"]}
],
"Tests": [
{ "Path": "Specs", "Excludes": ["*.js"]}
]
}
```