{"id":290,"date":"2020-01-26T12:45:01","date_gmt":"2020-01-26T10:45:01","guid":{"rendered":"https:\/\/arnoldvanhofwegen.com\/blog\/?p=290"},"modified":"2020-01-26T12:45:01","modified_gmt":"2020-01-26T10:45:01","slug":"gtk-test-compilation-in-c-gnome-examples","status":"publish","type":"post","link":"https:\/\/arnoldvanhofwegen.com\/blog\/gtk-test-compilation-in-c-gnome-examples\/","title":{"rendered":"GTK test compilation in C, Gnome examples"},"content":{"rendered":"\n<figure class=\"wp-block-gallery columns-0 is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><\/ul><\/figure>\n\n\n\n<p>So on the road to create a GUI for REN-C. Chosen for GTK as a first target. Taking the smallest steps possible to get a deep understanding of the nature of that beast.<\/p>\n\n\n\n<p>Followed the steps on <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/developer.gnome.org\/gtk3\/stable\/gtk-getting-started.html\" target=\"_blank\">https:\/\/developer.gnome.org\/gtk3\/stable\/gtk-getting-started.html<\/a> to get the simplest examples compiled on my Ubuntu system.<\/p>\n\n\n\n<p>Learning about backticks (that horrible sign that is not a normal single quote: &#8216;`&#8217; ) from here <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/developer.gnome.org\/gtk3\/stable\/gtk-compiling.html\" target=\"_blank\">https:\/\/developer.gnome.org\/gtk3\/stable\/gtk-compiling.html<\/a> that they can be used to copy a result of a command in the command that is being executed.<\/p>\n\n\n\n<p>So I created my example-0.c file and tried to compile<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gcc `pkg-config --cflags gtk+-3.0` -o example-0 example-0.c `pkg-config --libs gtk+-3.0`<\/code><\/pre>\n\n\n\n<p>But it failed<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Package gtk+-3.0 was not found in the pkg-config search path.\nPerhaps you should add the directory containing `gtk+-3.0.pc'\nto the PKG_CONFIG_PATH environment variable\nNo package 'gtk+-3.0' found\nPackage gtk+-3.0 was not found in the pkg-config search path.\nPerhaps you should add the directory containing `gtk+-3.0.pc'\nto the PKG_CONFIG_PATH environment variable\nNo package 'gtk+-3.0' found\nexample-0.c:1:10: fatal error: gtk\/gtk.h: Bestand of map bestaat niet\n #include &lt;gtk\/gtk.h>\n          ^~~~~~~~~~~\ncompilation terminated.\n<\/code><\/pre>\n\n\n\n<p>It is evident that even though I run Ubuntu that uses GNOME(3) and thus must know how to handle the GTK all its stuff is made for, when compiling the headers must be present somewhere, and they are not. So I needed to install them. The search engine is your friend so I found out what to do:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get install libgtk-3-dev<\/code><\/pre>\n\n\n\n<p>This got 22MB of archives and 105MB installed stuff down to the computer.<\/p>\n\n\n\n<p>But now in usr\/include there is a folder gtk-3.0 installed and pkg-config &#8211;cflags gtk+-3.0 now does return a result. The programs can be compiled now using the strings suggested an the generated programs do what they are supposed to do.<\/p>\n\n\n\n<p>To see what packages concerning GTK are installed, this command can also come in handy, I found it using the search engine friend.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dpkg -l libgtk* | grep -e '^i' | grep -e 'libgtk-*&#91;0-9]'<\/code><\/pre>\n\n\n\n<p>Having it here is convenient I guess.<\/p>\n\n\n\n<p>Till next blog!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So on the road to create a GUI for REN-C. Chosen for GTK as a first target. Taking the smallest steps possible to get a deep understanding of the nature of that beast. Followed the steps on https:\/\/developer.gnome.org\/gtk3\/stable\/gtk-getting-started.html to get &hellip; <a href=\"https:\/\/arnoldvanhofwegen.com\/blog\/gtk-test-compilation-in-c-gnome-examples\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"gallery","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/arnoldvanhofwegen.com\/blog\/wp-json\/wp\/v2\/posts\/290"}],"collection":[{"href":"https:\/\/arnoldvanhofwegen.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/arnoldvanhofwegen.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/arnoldvanhofwegen.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/arnoldvanhofwegen.com\/blog\/wp-json\/wp\/v2\/comments?post=290"}],"version-history":[{"count":2,"href":"https:\/\/arnoldvanhofwegen.com\/blog\/wp-json\/wp\/v2\/posts\/290\/revisions"}],"predecessor-version":[{"id":292,"href":"https:\/\/arnoldvanhofwegen.com\/blog\/wp-json\/wp\/v2\/posts\/290\/revisions\/292"}],"wp:attachment":[{"href":"https:\/\/arnoldvanhofwegen.com\/blog\/wp-json\/wp\/v2\/media?parent=290"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/arnoldvanhofwegen.com\/blog\/wp-json\/wp\/v2\/categories?post=290"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/arnoldvanhofwegen.com\/blog\/wp-json\/wp\/v2\/tags?post=290"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}