Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8903067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:46:36+00:00 2026-06-15T01:46:36+00:00

I am new to gtk programming and d and learning using demos from gtkd

  • 0

I am new to gtk programming and d and learning using demos from gtkd source. when i try to compile the code below [ i am using dmd-2.060 and gtkd-2.0 on archlinux ].

/*
    Modified sourceview demo for learning gtk programming in d
*/

pragma(lib, "gtkd");
pragma(lib, "gtkdsv");
pragma(lib, "dl");


import gtk.MainWindow;
import gtk.Main;
import gtk.Widget;
//import gtk.TextView;


import gsv.SourceView;

import std.stdio;
import std.file;


/**
 * Demos for SourceView.
 * TODO on gsv: override methods from TextView, TextBuffer, etc
 */

class HelloWorld : MainWindow
{

    SourceView sourceView;
    //TextView textView;

    this()
    {
        super("GtkD SourceView");
        setBorderWidth(10);
        add(getSourceView());
        setDefaultSize(640,400);
        showAll();
    }

    private Widget getSourceView()
    {
        sourceView = new SourceView();
        return sourceView;

        //textView = new TextView();
        //return textView;
    }

}

void main(string[] args)
{
    Main.init(args);
    new HelloWorld();
    Main.run();

}

I get errors like this

/usr/lib/libgtkdsv.a(SourceCompletionInfo.o):(.data+0x140): undefined reference to `_D3gtk8TextView12__ModuleInfoZ'
/usr/lib/libgtkdsv.a(SourceGutterRenderer.o):(.data+0xe8): undefined reference to `_D3gtk8TextView12__ModuleInfoZ'
/usr/lib/libgtkdsv.a(SourceGutterRenderer.o): In function `_D3gsv20SourceGutterRenderer20SourceGutterRenderer7getViewMFZC3gtk8TextView8TextView':
(.text._D3gsv20SourceGutterRenderer20SourceGutterRenderer7getViewMFZC3gtk8TextView8TextView+0x7e): undefined reference to `_D3gtk8TextView8TextView7__ClassZ'
/usr/lib/libgtkdsv.a(SourceGutterRenderer.o): In function `_D3gsv20SourceGutterRenderer20SourceGutterRenderer7getViewMFZC3gtk8TextView8TextView':
(.text._D3gsv20SourceGutterRenderer20SourceGutterRenderer7getViewMFZC3gtk8TextView8TextView+0x94): undefined reference to `_D3gtk8TextView8TextView6__ctorMFPS4gtkc8gtktypes11GtkTextViewZC3gtk8TextView8TextView'
collect2: error: ld returned 1 exit status
--- errorlevel 1

But when i comment SourceView related code and uncomment TextView related code it compiles and runs fine.

Note: This code is from SVTest.d file on sourceView gtkd demos directory.

Edit: I was doing dmd SVTest.d to compile which was giving me that error now i did
dmd -L-ldl -L-lgtkd -L-lgtkdsv SVTest.d and it compiled fine. Now if i remove the pragma statements and try to compile with compiler flags it fails. I am bit confused here, D doc said pragma was for passing information to compiler! do i need both pragma and compiler flags to compile source code? or am i doing something wrong?

Update: Indeed the pragma order mattered, I changed pragma to this

pragma(lib, "gtkdsv");
pragma(lib, "gtkd");
pragma(lib, "dl");

Now i can just do

dmd main.d

which i was originally wanting to do.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T01:46:37+00:00Added an answer on June 15, 2026 at 1:46 am

    I believe that the order of the linker flags matters. gtkd loads shared objects, and needs libdl, so -l-Ldl needs to be first in the list. (which you did on the terminal)

    Try moving pragma(lib, “dl”); to the first spot, and see if that makes a difference.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

New programmer here, I am trying to understand and break down this code below
Intro I am new to GTK+ programming and am having difficulty understanding why the
I'm using VC++ 2008 and I've the code: #include <gtk/gtk.h> int main( int argc,
When trying to compile with Code::Blocks the example that comes up with GTK+: #include
I'm new to GUI programming with python and gtk, so this is a bit
I'm somewhat new to GTK and very new to Cairo. I've been tasked to
I am new to Gtk and want to do simple drawing of shapes like
I'm using gtk.combo_box_new_text() to make combobox list, this uses a gtk.ListStore to store only
new on ruby and using windows xp and rails 3, i want to send
New to PHP and MySQL, have heard amazing things about this website from Leo

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.