Recent

Author Topic: GTK2 Sig Seg V Error  (Read 10190 times)

captian jaster

  • Guest
GTK2 Sig Seg V Error
« on: August 05, 2010, 02:19:33 pm »
I Use this code :
Code: Pascal  [Select][+][-]
  1.  program Base;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. uses
  6.   gtk;
  7.  
  8. Var
  9.  Window:pGTKWidget;
  10.  
  11. begin
  12.   gtk_init(@argv,@argv);
  13.   Window := gtk_window_new(GTK_WINDOW_TOPLEVEL);
  14.   gtk_widget_show(Window);
  15.   gtk_main();
  16. end.
  17.              
  18.  
and it says that the dll :libgtk-0 is missing

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: GTK Dll Error D:
« Reply #1 on: August 05, 2010, 02:59:36 pm »
Windows or Linux?

Anyway, the message is rather clear, you need to install Gtk and make sure it is in the path where the operating system looks for libraries.

captian jaster

  • Guest
Re: GTK Dll Error D:
« Reply #2 on: August 05, 2010, 03:05:45 pm »
I Installed This : http://gtk-win.sourceforge.net/home/index.php/en/Downloads
And the error still comes up..
What Path Should i install it to?

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: GTK Dll Error D:
« Reply #3 on: August 05, 2010, 03:53:41 pm »
I Installed This : http://gtk-win.sourceforge.net/home/index.php/en/Downloads
And the error still comes up..

To which directory where the DLLs installed? Windows comes with a search utility which can search your whole disk if you have no idea.

Quote
What Path Should i install it to?

Usually the DLLs should be either in the directory of your executable or in Windows\System32

Just copy them to one of those

captian jaster

  • Guest
Re: GTK Dll Error D:
« Reply #4 on: August 05, 2010, 04:15:41 pm »
Instead of installing the whole thing i just downloaded the DLLs one by one.
Now I have another problem. i compiled the code and it says external sig seg v.. whats wrong?

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: GTK Dll Error D:
« Reply #5 on: August 05, 2010, 04:53:58 pm »
In your uses clause it should be:

uses gtk2;

I wouldn't recommend using gtk 1 for anything.

captian jaster

  • Guest
GTK2 Sig Seg V Error
« Reply #6 on: August 06, 2010, 02:06:32 pm »
Code: Pascal  [Select][+][-]
  1. program Base;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. uses
  6.   GTK2;
  7.  
  8. Var
  9.  Window:pGTKWidget;
  10.  
  11. begin
  12.   gtk_init(@argv,@argv);
  13.   Window := gtk_window_new(GTK_WINDOW_TOPLEVEL);
  14.   gtk_widget_show(window);
  15.   gtk_main();
  16. end.
  17.              
  18.  
I Have All the correct Dll files and im using this tutorial.. http://www.freepascal.org/packages/gtk/tutorial/pgtk-contents.html
What is wrong?
When i compile the program a window doesnt come up its the console screen :\... Then it tells me the error.. Im Using Lazarus to do this.. whats wrong?

Leledumbo

  • Hero Member
  • *****
  • Posts: 8552
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: GTK2 Sig Seg V Error
« Reply #7 on: August 06, 2010, 03:29:37 pm »
Do you compile your program with -gl? It should show a backtrace when an error occurs. You can also add SysUtils to uses clause to help identifying errors.

captian jaster

  • Guest
Re: GTK2 Sig Seg V Error
« Reply #8 on: August 06, 2010, 03:35:32 pm »
-gl is a compiler director?

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: GTK2 Sig Seg V Error
« Reply #9 on: August 06, 2010, 03:45:37 pm »
You have a bug in your code. In this line:

  gtk_init(@argv,@argv);

It works if you change it to the correct value:

  gtk_init(@argc,@argv);

captian jaster

  • Guest
Re: GTK2 Sig Seg V Error
« Reply #10 on: August 06, 2010, 03:49:32 pm »
Cool... Now how can i make the console go away?
(Also Thanks.)

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: GTK2 Sig Seg V Error
« Reply #11 on: August 06, 2010, 04:16:00 pm »
Menu Project -> Project Options -> Linking

Select "win32 gui application"

you are welcome

captian jaster

  • Guest
Re: GTK2 Sig Seg V Error
« Reply #12 on: August 06, 2010, 11:07:52 pm »
Menu Project -> Project Options -> Linking

Select "win32 gui application"

you are welcome
Thank You!

 

TinyPortal © 2005-2018