gtkd-developers / GtkD

GtkD is a D binding and OO wrapper of GTK+ originally created by Antonio Monteiro
http://gtkd.org
Other
322 stars 71 forks source link

Undefined reference to _D3std6string9toStringzFNaNbNeMNkAyaZPya with ldc2 #333

Closed Dadoum closed 3 years ago

Dadoum commented 3 years ago
gtk-d:gtkd 3.9.0: target for configuration "library" is up to date.
gtk-d:gstreamer 3.9.0: target for configuration "library" is up to date.
gtk-d:peas 3.9.0: target for configuration "library" is up to date.
gtk-d:sv 3.9.0: target for configuration "library" is up to date.
gtk-d:vte 3.9.0: target for configuration "library" is up to date.
sampleproj ~main: building configuration "application"...
Linking...
Loader.d:433 : erreur : référence à « _D3std6string9toStringzFNaNbNeMNkAyaZPya » non définie
Loader.d:419 : erreur : référence à « _D3std6string9toStringzFNaNbNeMNkAyaZPya » non définie
collect2: erreur: ld a retourné le statut de sortie 1
Error: /usr/bin/cc failed with status: 1
/usr/bin/ldc failed with exit code 1.

translation: Undefined reference to= référence...non définie

MikeWey commented 3 years ago

If you updated the compiler recently you may need to force dub to rebuild GtkD, this look like an error that heapons when updating the compiler. An undefined reference to a symbol in Phobos.

Dadoum commented 3 years ago

Also getPreferredWidth seems to have problems when overriden. It asks both two use (int minimum, int natural) and (out int, out int)

Dadoum commented 3 years ago

And I cleaned. But it could be a compiler issue since gdc and dmd works well.

MikeWey commented 3 years ago

I can't reproduce the getPreferredWidth issue locally with GtkD master and ldc2 1.25.1.

Dadoum commented 3 years ago

Can you give me your code snipet (I am not sure if I'm doing that correctly)

MikeWey commented 3 years ago

Can you give me a snipet that doesn't work, that is a lot easier troubleshooting.

Dadoum commented 3 years ago
class TextEditorMargin: Box {
    import gobject.c.functions : g_object_newv;
    import gtk.c.types;
    import gtkd.Implement;

    mixin ImplementClass!GtkBox;

    this() {
        super(Orientation.VERTICAL, 0);
        addOnDraw(&onDraw);
    }

    public override void getPreferredWidth(out int minimumWidth, out int naturalWidth) {
        int minimumWidthSuper, naturalWidthSuper;
        super.getPreferredWidth(minimumWidthSuper, naturalWidthSuper);
        minimumWidth = max(minimumWidthSuper, 12);
        naturalWidth = max(naturalWidthSuper, 12);
    }

    public bool onDraw(Context cr, Widget sender) {
        cr.paint();
        return true;
    }
}
MikeWey commented 3 years ago

This is a problem with gtkd.Implement, that currently only seems to handle out and ref for gtkD classes.

Dadoum commented 3 years ago

Can I do anything to fix this ?

MikeWey commented 3 years ago

Should be fixed now for this case, but not all types are handles properly yet.

Dadoum commented 3 years ago

Okay, but the function does not seems to be called... but not sure about that; and anyway I think you forgot to remove some debug output