Skip to content

JPEG Library Setup (Requires GTK 4)

VerzatileDev edited this page Aug 31, 2023 · 1 revision
  1. Install Mysy2 Application
  2. Follow the specifications of GTK 4 Installation pacman -S mingw-w64-x86_64-gtk4
  3. Use pacman -Ss jpeglib.h in Msys2.
  4. Use pacman -S mingw-w64-x86_64-libjpeg in Msys2
  5. Use pacman -Syu In Msys2 (Makes sure all packages are applied.
  6. The following is with GTK 4 and JpegLib -> c_cpp_properties.json
{
    "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/**",
                "${workspaceFolder}/src/converters" // Add this line
            ],
            "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
  }
  1. The following for Tasks.json:
{
	"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}",
			"-o",
			"${fileDirname}/converters/bmp_to_jpeg.exe",
			"-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",
			"-ljpeg",
			"-o",
			"${fileDirname}/${fileBasenameNoExtension}.exe"
		 ],
		  "options": {
			 "cwd": "C:/msys64/mingw64/bin"
		  },
		  "problemMatcher": [
			 "$gcc"
		  ],
		  "group": "build",
		  "detail": "compiler: C:/msys64/mingw64/bin/gcc.exe"
	   }
	]
}
  1. Make sure you have Msys2 / GTK 4 Installed before using the following library or else it might add to the wrong folders and result it not working as initially intended.
  2. Make sure GTK 4 folder is additionally added to " Edit System environment variables "
  3. The following guide is in GTK 4 Wiki!
Clone this wiki locally