Skip to content

Instantly share code, notes, and snippets.

@willianuk
Forked from Acry/VSCode C Linux.md
Created May 2, 2021 23:20
Show Gist options
  • Save willianuk/2c91435dfaa656605960caf3081e4d4d to your computer and use it in GitHub Desktop.
Save willianuk/2c91435dfaa656605960caf3081e4d4d to your computer and use it in GitHub Desktop.
Kick off VSCode for C and GTK 3.

Code GTK 3 in C with VSCode

Kick off VSCode for C and GTK 3.

c_cpp_properties.json

{
  "configurations": [
    {
      "name": "C Linux GTK3",
      "includePath": [
        "${workspaceFolder}/**",
        "/usr/lib/glib-2.0/include/",
        "/usr/include/gtk-3.0",
        "/usr/include/pango-1.0",
        "/usr/include/glib-2.0",
        "/usr/lib/libffi-3.2.1",
        "/usr/include/harfbuzz",
        "/usr/include/fribidi",
        "/usr/include/freetype",
        "/usr/include/libpng16",
        "/usr/include/cairo",
        "/usr/include/pixman-1",
        "/usr/include/gdk-pixbuf-2.0",
        "/usr/include/libmount",
        "/usr/include/blkid",
        "/usr/include/gio-unix-2.0",
        "/usr/include/atk-1.0",
        "/usr/include/at-spi2-atk/2.0",
        "/usr/include/at-spi-2.0",
        "/usr/include/dbus-1.0",
        "/usr/lib/dbus-1.0/include",
        "/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/include",
        "/usr/local/include",
        "/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/include-fixed",
        "/usr/include"
      ],
      "defines": [],
      "compilerPath": "/usr/bin/gcc",
      "cStandard": "c11",
      "cppStandard": "c++17",
      "intelliSenseMode": "clang-x64",
      "compilerArgs": [
        "-Wall",
        "-Wextra",
        "-mtune=native",
        "-no-pie",
        "`pkg-config gtk+-3.0 --cflags`",
        "`pkg-config --libs gtk+-3.0`",
        "-lm"
      ]
    }
  ],
  "version": 4
}

Code GTK 3 in C with VSCode

Kick off VSCode for C and GTK 3.

Prerequisites

Compiler

GCC and Clang

Build Tools

pkg-config and GNU Make

Used Extension

Name: C/C++
Id: ms-vscode.cpptools
Description: C/C++ IntelliSense, debugging, and code browsing.
Version: 0.26.2
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools

Config

see:
.vscode/c_cpp_properties.json

That is basically:
pkg-config --libs --cflags gtk+-3.0

Where your glibconfig.h lives:
/usr/lib/glib-2.0/include/

And the output from
cpp -v

That is my include search path for the C preprocessor:

/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/include
/usr/local/include
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/include-fixed
/usr/include

Prerequisites

Compiler

GCC and Clang

Build Tools

pkg-config and GNU Make (optinal)

Used Extension

Name: C/C++
Id: ms-vscode.cpptools
Description: C/C++ IntelliSense, debugging, and code browsing.
Version: 0.26.2
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools

Config

see:
.vscode/c_cpp_properties.json

That is basically:
pkg-config --libs --cflags gtk+-3.0

Where your glibconfig.h lives:
/usr/lib/glib-2.0/include/

And the output from
cpp -v

That is my include search path for the C preprocessor:

/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/include
/usr/local/include
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/include-fixed
/usr/include
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment