I was hoping to run GStreamer Hello World example in a Linux Virtualbox with VS Code.
Gstreamer install directions here.
GStreamer HelloWorld info here.
The manual C build/compile command is $ gcc basic-tutorial-1.c -o basic-tutorial-1 'pkg-config --cflags --libs gstreamer-1.0'
Works great that way. But, I was hoping to use Visual Studio Code, and I'm trying to push the 'pkg-config --cflags --libs gstreamer-1.0' content into my launch.json file. It's not clear to me on how exactly to do that.
I started with a launch.json file which I believe was created by the C/C++ plugin from Microsoft within VS Code. I did not add a CMakeLists file. There are no other extensions installed within VS Code.
My current launch.json file: (test #17 or so...)
{
"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": [{ "name": "pkg-config", "value": " --cflags"},{"name": "--libs", "value": "gstreamer-1.0"}],
"externalConsole": false,
"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/gdb"
}
]
}
The error I'm seeing? cannot open source file "gst/gst.h" I don't understand what launch.json is looking for.
Edit/Comment: Apparently this is not a new issue.
- https://www.javaer101.com/en/article/37220391.html
- (How to configure VSCode for GTK3 for intellisense / build / debug and g++)
- VS Code C/C++ configuration for GTK development
- https://www.reddit.com/r/vscode/comments/joozcp/escaping_backticks_command_substitution/
- https://www.reddit.com/r/vscode/comments/m66kpr/how_to_add_pkgconfig_compiler_arguments_to_vscode/
- How to use `pkg-config gtkmm-3.0 --cflags --libs` in the Visual Studio Code
And I'm just not seeing a clear solution. The solutions from DarkTrick work, but are pretty ugly. Ugly enough to push one over to Visual Studio instead of VS Code. Another option is to use CMakeLists.txt with VS Code. That uses multiple .vscode files, but at least they are generated as opposed to just hacked.
Anybody else got a simple solution to use pkg-config with VS code and launch.json?