Hi Dani

I am trying to develop a case study in c languade for addressbook.Is glade a turbo c accepted GUI.
If so how can I link c program functions, xml etc with glade.I have no idea.Please reply as soon as possible.

Thanks
Saranya

Dani AI

Generated

A short, practical path for : Glade is a UI designer that saves widget layouts as .ui (XML) files. To use those with a C program you do not “link” them at compile time — you load the .ui at runtime with GTK’s builder API and implement callbacks in C. This avoids DOS-era toolchains: use a modern C compiler (GCC/Clang or MinGW/MSYS2 on Windows) rather than Turbo C. and were on the right track about tool choice; below are concrete steps and tips.

Minimal pattern (create UI in Glade, give widgets and signal handlers names, then load and connect in C):

#include <gtk/gtk.h>

void on_add_clicked(GtkButton *btn, gpointer user_data) {
    /* address-book logic */
}

int main(int argc, char **argv) {
    gtk_init(&argc, &argv);
    GtkBuilder *b = gtk_builder_new_from_file("addressbook.ui");
    GtkWidget *win = GTK_WIDGET(gtk_builder_get_object(b, "main_window"));
    gtk_builder_connect_signals(b, NULL);
    gtk_widget_show_all(win);
    gtk_main();
    return 0;
}

Compile with pkg-config so the right flags are used:

gcc -o addressbook addressbook.c $(pkg-config --cflags --libs gtk+-3.0)

Troubleshooting and practical notes:

  • Use GtkBuilder (not the old libglade) and match Glade’s GTK version to the GTK runtime.
  • If gtk_builder_new_from_file or gtk_builder_get_object returns NULL, check file path, object IDs, and console error messages.
  • On Windows prefer an MSYS2/MinGW toolchain and install the GTK packages there.
  • For distribution consider embedding the .ui with GResource or installing it alongside the binary.

Further reference: the official Glade site (https://glade.gnome.org/) and the GtkBuilder docs (https://docs.gtk.org/gtk3/class.Builder.html).

Recommended Answers

All 2 Replies

I would be amazed if anything written in this millenium that wasn't specifically written in Turbo C would be compatible with TC. It is an MS-DOS compiler that is more than 25 years old, and is not compatible with anything, including the last three versions of Windows. It would be a terrible mistake to write any new programs in Turbo C.

Glade, on the other hand, is specifically a Rapid Application Development toolkit for Gnome, though it does work with most other Linux window managers. While it does have a Windows port, it certainly won't work under DOS.

What Schol-R-LEA said. For a cross-platform GUI development tool set, use either Qt, or Wx - Qt is preferred. That said, they are C++, not C API's. AFAIK, there are no standard GUI tools that are strictly C based, other than text-based ones such as curses/ncurses.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.