GTK + SQLite, on Visual Studio 2019, Windows 10 (C++) [OBSOLETE 18sept2020]

EDIT. open classroom tutorial with executable links is no longer available this tutorial is obsolete, however, I will try the classic way to install last GTK+ update

Just a Tutorial for installation of GTK and SQLite in your project on Visual Studio 2019.

This Article is based on differents French/english Tutorial
These tutorials is great, but old, I want to share some tips, to install GTK on visual studio 2019 and SQLite

Before start any configurations you need to download some files :

- Runtime GTK+ and Setup_Pack_GTK.exe available on french tutorial about GTK here
- SQLite amalgation and SQLite Precompiled Binaries for Windows x86 available here

Instalation of GTK+

if you speak French you can follow tutorial of OpenClassrooms and stop to "Configuration du Logiciel & d'un Projet GTK+"

---------------------------------------------
First you need to install Setup_Runtime_GTK+_2.10.exe in C:\WINDOWS\System32
Just verify you don't target a 2.0 folder.

This installation can be removed from your computer without damage your Windows Installation
in parameter of Windows 10.

this "setup" alert you this folder already exist just say "yes".
This installation claim 27MB in your disk Drive.
Note on OpenClassrooms: this installation just copy files in directory

After that run and install in C:\Program Files\Pack GTK+ the Setup_Pack_GTK+_2.10_by_Im@GinE.exe (you can install in Program Files x86 folder but you need to replace some directories in VS2019, given in this "tutorial").
This installation claim 185MB

Configuration of VS2019 Project


This configuration is for one project, and it very boring to do that every project, maybe I will create a project template for GTK (or you can create your own template).

first open VS2019 and create a new project in C++, console Application

go in project settings --> VC++ Repertory, and add following directories :
Include ( .h an .c files) :
C:\Program Files\Pack GTK+\include
C:\Program Files\Pack GTK+\include\atk
C:\Program Files\Pack GTK+\include\cairo
C:\Program Files\Pack GTK+\include\cairo\src
C:\Program Files\Pack GTK+\include\glib
C:\Program Files\Pack GTK+\include\glib\build
C:\Program Files\Pack GTK+\include\glib\glib
C:\Program Files\Pack GTK+\include\glib\gmodule
C:\Program Files\Pack GTK+\include\glib\gobject
C:\Program Files\Pack GTK+\include\glib\gthread
C:\Program Files\Pack GTK+\include\gtk+
C:\Program Files\Pack GTK+\include\gtk+\contrib
C:\Program Files\Pack GTK+\include\gtk+\gtk
C:\Program Files\Pack GTK+\include\gtk+\gdk
C:\Program Files\Pack GTK+\include\gtk+\gdk-pixbuf
C:\Program Files\Pack GTK+\include\gtk+\modules
C:\Program Files\Pack GTK+\include\libpng
C:\Program Files\Pack GTK+\include\libpng\contrib
C:\Program Files\Pack GTK+\include\pango
C:\Program Files\Pack GTK+\include\pango\modules
C:\Program Files\Pack GTK+\include\pango\pango
C:\Program Files\Pack GTK+\include\tiff
C:\Program Files\Pack GTK+\include\tiff\libtiff
C:\Program Files\Pack GTK+\lib\glib\include
C:\Program Files\Pack GTK+\lib\gtk+\include

Bin (dll, etc...) :
C:\Program Files\Pack GTK+\bin
Lib (.lib files) :
C:\Program Files\Pack GTK+\lib



Finally in "link editor" ("Editeur de lien" in french version) entry -> dependency
add this list of files:
glib-2.0.lib
pangocairo-1.0.lib
pangowin32-1.0.lib
atk-1.0.lib
gdk_pixbuf-2.0.lib
gdk-win32-2.0.lib
pango-1.0.lib
gmodule-2.0.lib
gobject-2.0.lib
gthread-2.0.lib
gtk-win32-2.0.lib
cairo.lib


Add SQLite in Project


extract files in downloaded files of SQLite.
and put all files in project directory (without create folder)

Open Developer Command Prompt for VS 2019.

a cmd command line will be opened and with the "cd" command go to your project directory and write this command :
LIB /DEF:sqlite3.def

After is done go on VS2019 project and add in dependency (same as GTK .lib file) sqlite3.lib
and "add existing element" "sqlite3.c" in project

And it's done...

GaumKap
(this is just a way to add GTK in VS 2019 I found on internet... I failed to install it normally) -------------------------------------------------------------------------
Sources :
https://dcravey.wordpress.com/2011/03/21/using-sqlite-in-a-visual-c-application/ https://www.sqlite.org/download.html https://openclassrooms.com/fr/courses/1387611-creez-une-interface-avec-gtk/1387915-installer-gtk-sous-windows

Comments

Popular posts from this blog

SpeedRuns [ Update : 01/04/2023]

Coyouu Project a0.0.1 is Available