RomoBoom
Posts: 45
Joined: Sat Sep 01, 2018 12:07 am

i am trying to make a small window appear, with nothing in it, but it just isn't working.

Sun May 05, 2019 1:58 pm

i am trying to make a small window appear, with nothing in it, but it just isn't working
The code is from a book called
AN INTRODUCTION TO
---------C & GUI-------------
----PROGRAMMING-----
By: Simon Long
Code:

Code: Select all

#include <gkt/gkt.h>

int main (int argc,char *argv[])
{
  gkt_init (&argc, &argv);
  GtkWidget *win = gkt_window_new (GKT_WINDOW_TOPLEVEL);
  gkt_widget_show (win);
  gkt_main ();
  return 0;
}
(in geany)
and this happens
(i ran it through the terminal)
error.png
picture of error
error.png (116.95 KiB) Viewed 960 times
if you see what is wrong, please tell me, so that i can fix it :D :D :)

User avatar
buja
Posts: 498
Joined: Wed Dec 31, 2014 8:21 am
Location: Netherlands

Re: Is this wrong?

Sun May 05, 2019 2:01 pm

Just a guess: wrong spelling: gkt => should be gtk, try:

Code: Select all

#include <gtk/gtk.h>
Edit: now that I try it myself I see that you made the same typo everywhere :lol:
Edit 2: it might be a good idea to download the PDF of the book and copy & paste the example programs instead of typing them, saves a few errors.
Last edited by buja on Mon May 06, 2019 1:00 pm, edited 1 time in total.

User avatar
B.Goode
Posts: 8271
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Is this wrong?

Sun May 05, 2019 3:37 pm

This is a cut'n paste of the PDF download -

Code: Select all

#include <gtk/gtk.h>
int main (int argc, char *argv[])
{
 gtk_init (&argc, &argv);
 GtkWidget *win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
 gtk_widget_show (win);
 gtk_main ();
 return 0;
}

So unless something went badly wrong when the paper book was printed, it seems your code is not what is in the book.

cmrincon
Posts: 29
Joined: Thu May 24, 2018 7:39 pm

Re: Is this wrong?

Mon May 06, 2019 10:27 am

From that same guide:

Code: Select all

First we need to make sure that the relevant GTK libraries are installed. To do this, type
sudo apt-get install libgtk2.0-dev into a terminal window and answer yes to any
prompts – this installs the developer libraries for GTK 2.

User avatar
B.Goode
Posts: 8271
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Is this wrong?

Mon May 06, 2019 10:38 am

cmrincon wrote:
Mon May 06, 2019 10:27 am
From that same guide:

Code: Select all

First we need to make sure that the relevant GTK libraries are installed. To do this, type
sudo apt-get install libgtk2.0-dev into a terminal window and answer yes to any
prompts – this installs the developer libraries for GTK 2.


Obviously correct in itself.


But as already stated, it won't help with compilation of code that contains:

Code: Select all

#include <gkt/gkt.h>

RomoBoom
Posts: 45
Joined: Sat Sep 01, 2018 12:07 am

Re: Is this wrong?

Sun May 12, 2019 5:22 pm

buja wrote:
Sun May 05, 2019 2:01 pm
Just a guess: wrong spelling: gkt => should be gtk, try:

Code: Select all

#include <gtk/gtk.h>
Edit: now that I try it myself I see that you made the same typo everywhere :lol:
Edit 2: it might be a good idea to download the PDF of the book and copy & paste the example programs instead of typing them, saves a few errors.
its from a book, so no copy paste

RomoBoom
Posts: 45
Joined: Sat Sep 01, 2018 12:07 am

Re: i am trying to make a small window appear, with nothing in it, but it just isn't working.

Sun May 12, 2019 5:30 pm

i did everything that you guys said, and this happened :x
same error,
different code.
Attachments
error2.png
error2.png (156.32 KiB) Viewed 739 times

RomoBoom
Posts: 45
Joined: Sat Sep 01, 2018 12:07 am

Re: i am trying to make a small window appear, with nothing in it, but it just isn't working.

Sun May 12, 2019 5:38 pm

ugh

i found it
if you see it, you have good eyes
Attachments
error3.png
(Hint: gkt)
error3.png (5.61 KiB) Viewed 737 times

RomoBoom
Posts: 45
Joined: Sat Sep 01, 2018 12:07 am

Re: i am trying to make a small window appear, with nothing in it, but it just isn't working.

Sun May 12, 2019 5:42 pm

YASSSSSSS!!!! it worked!!! :D :D :D :D :D :D :D :D :lol: :lol: :lol: :) :D

THANK YOU EVERYONE!!!
Attachments
sucsess!.png
sucsess!.png (60.51 KiB) Viewed 735 times

RomoBoom
Posts: 45
Joined: Sat Sep 01, 2018 12:07 am

Re: i am trying to make a small window appear, with nothing in it, but it just isn't working.

Sun May 12, 2019 5:48 pm

:D

just saying, this is a base for something bigger, i just had to get this right! :D

Return to “C/C++”