Skip to content

Commit f4724f7

Browse files
committed
#include <gtk/gtk.h> Addition
In the following addition it is required to keep " C_cpp_properties.json and tasks.json within the project as that is required for the library to work. Having removed user based vscode additions it should work as intended! Leaving instructions here: Step 1: in Msys2 terminal you write this pacman -S mingw-w64-x86_64-gtk4 Step 2: pacman -S mingw-w64-x86_64-toolchain base-devel After you got those fuckers Step 3: you have a c project, and you need to generate those I'll most likely include in the commit so you dont have to fuck around with them unless you want to. Image Step 4: In main.c you want to try the code so copy paste #include <gtk/gtk.h> static void print_hello (GtkWidget *widget, gpointer data) { g_print ("Hello World\n"); } static void activate (GtkApplication *app, gpointer user_data) { GtkWidget *window; GtkWidget *button; window = gtk_application_window_new (app); gtk_window_set_title (GTK_WINDOW (window), "Window"); gtk_window_set_default_size (GTK_WINDOW (window), 200, 200); button = gtk_button_new_with_label ("Hello World"); g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL); gtk_window_set_child (GTK_WINDOW (window), button); gtk_window_present (GTK_WINDOW (window)); } int main (int argc, char **argv) { GtkApplication *app; int status; app = gtk_application_new ("org.gtk.example", G_APPLICATION_DEFAULT_FLAGS); g_signal_connect (app, "activate", G_CALLBACK (activate), NULL); status = g_application_run (G_APPLICATION (app), argc, argv); g_object_unref (app); return status; } Step 5: Open c_cpp_proprties.json Step 6: you need this exact promt, make sure that the root directory is correct!!!! { "configurations": [ { "name": "Win32", "includePath": [ "${workspaceFolder}/**", "C:/msys64/mingw64/include/gtk-4.0", "C:/msys64/mingw64/include/glib-2.0", "C:/msys64/mingw64/include/**", "C:/msys64/mingw64/lib/**" ], "defines": [ "_DEBUG", "UNICODE", "_UNICODE" ], "windowsSdkVersion": "10.0.22000.0", "compilerPath": "C:/msys64/mingw64/bin/gcc.exe", "cStandard": "c17", "cppStandard": "c++17", "intelliSenseMode": "windows-gcc-x64" } ], "version": 4 } Step 7: Make sure you add it into "edit environment settings" You got to add it to the System Environment - > Image So you need to add the bin folder that you downloaded mingw64 to and the gtk4 will be there as well Make sure that is right after program files otherwise won't work. Image all those ther and paths must be there for us to use it Image And that too, this is inside c_cpp_properties Image Step 8: you need task.json as well with this code { "version": "2.0.0", "tasks": [ { "type": "cppbuild", "label": "C/C++: gcc.exe build active file", "command": "C:/msys64/mingw64/bin/gcc.exe", "args": [ "-fdiagnostics-color=always", "-g", "-IC:/msys64/mingw64/include/gtk-4.0", "-IC:/msys64/mingw64/include/pango-1.0", "-IC:/msys64/mingw64/include", "-IC:/msys64/mingw64/include/glib-2.0", "-IC:/msys64/mingw64/lib/glib-2.0/include", "-IC:/msys64/mingw64/include/harfbuzz", "-IC:/msys64/mingw64/include/freetype2", "-IC:/msys64/mingw64/include/libpng16", "-IC:/msys64/mingw64/include/fribidi", "-IC:/msys64/mingw64/include/cairo", "-IC:/msys64/mingw64/include/pixman-1", "-IC:/msys64/mingw64/include/gdk-pixbuf-2.0", "-IC:/msys64/mingw64/include/webp", "-DLIBDEFLATE_DLL", "-IC:/msys64/mingw64/include/graphene-1.0", "-IC:/msys64/mingw64/lib/graphene-1.0/include", "-mfpmath=sse", "-msse", "-msse2", "${file}", "-LC:/msys64/mingw64/lib", "-lgtk-4", "-lpangowin32-1.0", "-lpangocairo-1.0", "-lpango-1.0", "-lharfbuzz", "-lgdk_pixbuf-2.0", "-lcairo-gobject", "-lcairo", "-lgraphene-1.0", "-lgio-2.0", "-lgobject-2.0", "-lglib-2.0", "-lintl", "-o", "${fileDirname}\\${fileBasenameNoExtension}.exe" ], "options": { "cwd": "C:/msys64/mingw64/bin" }, "problemMatcher": [ "$gcc" ], "group": "build", "detail": "compiler: C:/msys64/mingw64/bin/gcc.exe" } ] }
1 parent d21c06c commit f4724f7

File tree

4 files changed

+90
-4
lines changed

4 files changed

+90
-4
lines changed

C_image_processing/.gitignore

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,10 @@ dkms.conf
7777

7878
### VisualStudioCode ###
7979
.vscode/*
80-
!.vscode/settings.json
80+
!.vscode/c_cpp_properties.json
81+
#!.vscode/settings.json # user Specific
8182
!.vscode/tasks.json
82-
!.vscode/launch.json
83+
#!.vscode/launch.json # user Specific
8384
!.vscode/extensions.json
8485
!.vscode/*.code-snippets
8586

@@ -120,7 +121,5 @@ $RECYCLE.BIN/
120121
# Windows shortcuts
121122
*.lnk
122123

123-
# End of https://www.toptal.com/developers/gitignore/api/windows,visualstudiocode,c,c++
124-
125124
# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)
126125
output.bmp
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"configurations": [
3+
{
4+
"name": "Win32",
5+
"includePath": [
6+
"${workspaceFolder}/**",
7+
"C:/msys64/mingw64/include/gtk-4.0",
8+
"C:/msys64/mingw64/include/glib-2.0",
9+
"C:/msys64/mingw64/include/**",
10+
"C:/msys64/mingw64/lib/**"
11+
],
12+
"defines": [
13+
"_DEBUG",
14+
"UNICODE",
15+
"_UNICODE"
16+
],
17+
"windowsSdkVersion": "10.0.22000.0",
18+
"compilerPath": "C:/msys64/mingw64/bin/gcc.exe",
19+
"cStandard": "c17",
20+
"cppStandard": "c++17",
21+
"intelliSenseMode": "windows-gcc-x64"
22+
}
23+
],
24+
"version": 4
25+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"type": "cppbuild",
6+
"label": "C/C++: gcc.exe build active file",
7+
"command": "C:/msys64/mingw64/bin/gcc.exe",
8+
"args": [
9+
"-fdiagnostics-color=always",
10+
"-g",
11+
"-IC:/msys64/mingw64/include/gtk-4.0",
12+
"-IC:/msys64/mingw64/include/pango-1.0",
13+
"-IC:/msys64/mingw64/include",
14+
"-IC:/msys64/mingw64/include/glib-2.0",
15+
"-IC:/msys64/mingw64/lib/glib-2.0/include",
16+
"-IC:/msys64/mingw64/include/harfbuzz",
17+
"-IC:/msys64/mingw64/include/freetype2",
18+
"-IC:/msys64/mingw64/include/libpng16",
19+
"-IC:/msys64/mingw64/include/fribidi",
20+
"-IC:/msys64/mingw64/include/cairo",
21+
"-IC:/msys64/mingw64/include/pixman-1",
22+
"-IC:/msys64/mingw64/include/gdk-pixbuf-2.0",
23+
"-IC:/msys64/mingw64/include/webp",
24+
"-DLIBDEFLATE_DLL",
25+
"-IC:/msys64/mingw64/include/graphene-1.0",
26+
"-IC:/msys64/mingw64/lib/graphene-1.0/include",
27+
"-mfpmath=sse",
28+
"-msse",
29+
"-msse2",
30+
31+
"${file}",
32+
33+
"-LC:/msys64/mingw64/lib",
34+
"-lgtk-4",
35+
"-lpangowin32-1.0",
36+
"-lpangocairo-1.0",
37+
"-lpango-1.0",
38+
"-lharfbuzz",
39+
"-lgdk_pixbuf-2.0",
40+
"-lcairo-gobject",
41+
"-lcairo",
42+
"-lgraphene-1.0",
43+
"-lgio-2.0",
44+
"-lgobject-2.0",
45+
"-lglib-2.0",
46+
"-lintl",
47+
48+
"-o",
49+
"${fileDirname}\\${fileBasenameNoExtension}.exe"
50+
],
51+
"options": {
52+
"cwd": "C:/msys64/mingw64/bin"
53+
},
54+
"problemMatcher": [
55+
"$gcc"
56+
],
57+
"group": "build",
58+
"detail": "compiler: C:/msys64/mingw64/bin/gcc.exe"
59+
}
60+
]
61+
}

C_image_processing/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "filters/black_and_white_filter.c"
22
#include "filters/negative_filter.c"
3+
#include <gtk/gtk.h>
34

45
int main() {
56

0 commit comments

Comments
 (0)