VS Code Can't Find GTK on BBAI-64 (Fixed)

Hi,
I’ve got the dreaded VS Code / GTK error.

#include <gtk/gtk.h> : No such file or directory”.

This appears to be a common problem with VS Code because it’s all over the web. I’ve installed and included everything associated with building a GTK application but nothing seems to solve this.

VS Code can see the file because it suggests adding it to the include path but it still complains that the file can’t be found.

What am I not seeing?

Hi @CharlieC looking at:

https://packages.debian.org/search?searchon=contents&keywords=gtk%2Fgtk.h

Since Debian supports both gtk2 and gtk3, did you pass the proper CFLAG?


File	Packages
/usr/include/gtk-2.0/gtk/gtk.h	libgtk2.0-dev
/usr/include/gtk-3.0/gtk/gtk.h	libgtk-3-dev

For example, for gtk-3.0:

CFLAGS = `pkg-config --cflags gtk+-3.0`

Regards,

Weird. It works from the command line but not from VS Code.

Could it be because I’m running VS Code on a Windows 11 Pro laptop?

Would running VS Code from WSL2 make more sense? or perhaps directly on the BBAI-64?

Here’s one thing i found, to force VSCode…

Regards,

I’m also using ZMQ and it wasn’t included correctly either. All is well now. Here are my working configuration files for VS Code just in case this pops up again.

c_cpp_properties.json

{
“configurations”: [
{
“name”: “Linux”,
“includePath”: [
“${workspaceFolder}/**”
],
“defines”: [],
“compilerPath”: “/usr/bin/aarch64-linux-gnu-gcc”,
“cStandard”: “gnu17”,
“cppStandard”: “gnu++14”,
“intelliSenseMode”: “linux-gcc-arm64”
}
],
“version”: 4
}

tasks.json

{
“tasks”: [
{
“type”: “cppbuild”,
“label”: “C/C++: aarch64-linux-gnu-gcc build active file”,
“command”: “/usr/bin/aarch64-linux-gnu-gcc”,
“args”: [
“-fdiagnostics-color=always”,
“-g”,
“${file}”,
“-o”,
“${fileDirname}/${fileBasenameNoExtension}”,
“-lzmq”,
“-lczmq”,
pkg-config --cflags --libs gtk+-3.0
],
“options”: {
“cwd”: “${fileDirname}”
},
“problemMatcher”: [
“$gcc”
],
“group”: {
“kind”: “build”,
“isDefault”: true
},
“detail”: “Task generated by Debugger.”
}
],
“version”: “2.0.0”
}

Thanks for you help.