YggdrasiI/NeoLayoutViewer

`Menu' is an ambiguous reference between `GLib.Menu' and `Gtk.Menu'

Closed this issue · 8 comments

Hi,

when I want to compile the program I get the following error:

valac --thread --vapidir=vapi/ src/main.vala src/unique.vala src/neo-window.vala src/key-overlay.vala src/tray.vala src/config-manager.vala src/keybinding-manager.vala csrc/keysend.c csrc/checkModifier.c -o bin/neo_layout_viewer --pkg x11 --pkg keysym --pkg gtk+-2.0 --pkg gee-1.0 --pkg gdk-x11-2.0 --pkg posix --pkg unique-1.0
src/tray.vala:7.11-7.14: error: `Menu' is an ambiguous reference between `GLib.Menu' and `Gtk.Menu'
        private Menu menuMain;
                ^^^^
Compilation failed: 1 error(s), 0 warning(s)
make: *** [bulid_debug] Error 1

I'm running arch linux if that helps you...

Hello Jonasc,

please alter „Menu“ to „Gtk.Menu“ in src/tray.vala

I can not adjust this issue on my system (ubuntu 12.04) but will change this in the source, if this modification works on your system.

Ok, I renamed Menu to Gtk.Menu on line 7 and 30 in tray.vala but now I get a whole bunch of other errors:

src/key-overlay.vala:26.3-26.42: error: field type `Gee.HashMap<int,NeoLayoutViewer.ArrayBox>` is less accessible than field `NeoLayoutViewer.KeyOverlay.keysyms`
                public Gee.HashMap<int,ArrayBox> keysyms;
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^```

...

The name `get' does not exist in the context of `NeoLayoutViewer.KeyOverlay.keysyms'

...

The name `set' does not exist in the context of `NeoLayoutViewer.KeyOverlay.keysyms'

I installed libgee (there seems to be no libgee dev package on arch) maybe I'm missing some libs?

Which vala version did you use?

The first error
src/key-overlay.vala:26.3-26.42: error: field type Gee.HashMap<int,NeoLayoutViewer.ArrayBox> is less accessible than field NeoLayoutViewer.KeyOverlay.keysyms
public Gee.HashMap<int,ArrayBox> keysyms;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^```
should fixed by change of line 16 in key-overlay.vala (private -> public)
public class ArrayBox {

jonas@arch ~ % valac --version
Vala 0.16.1

Ok, now I'm a step further. I did this and now I'm getting this: right nowit looks more like it's a problem on my machine...

jonas@arch ~/neo_layout_viewer (git)-[master] % LC_ALL=en make
valac --thread --vapidir=vapi/ src/main.vala src/unique.vala src/neo-window.vala src/key-overlay.vala src/tray.vala src/config-manager.vala src/keybinding-manager.vala csrc/keysend.c csrc/checkModifier.c -o bin/neo_layout_viewer --pkg x11 --pkg keysym --pkg gtk+-2.0 --pkg gee-1.0 --pkg gdk-x11-2.0 --pkg posix --pkg unique-1.0
src/key-overlay.vala:783.4-783.30: warning: use of possibly unassigned parameter `requisition'
            requisition.width = width ;// / Pango.SCALE;
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/key-overlay.vala:784.4-784.31: warning: use of possibly unassigned parameter `requisition'
            requisition.height = height; // /  Pango.SCALE;
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/key-overlay.vala:778.38-778.68: warning: use of possibly unassigned parameter `requisition'
        public override void size_request (out Gtk.Requisition requisition) {
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/keybinding-manager.vala:54.48-54.51: warning: copying delegates is discouraged
/usr/bin/ld: /tmp/cc6o4oXv.o: undefined reference to symbol 'floor@@GLIBC_2.2.5'
/usr/bin/ld: note: 'floor@@GLIBC_2.2.5' is defined in DSO /usr/lib/libm.so.6 so try adding it to the linker command line
/usr/lib/libm.so.6: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
error: cc exited with status 256
Compilation failed: 1 error(s), 4 warning(s)
make: *** [bulid_debug] Error 1

On certain platforms math functions are included in libc and adding libm isn't necessary. Sounds like your system require -lm.
Could you please try this modification of line 19 in the Makefile?

VALAC = valac --thread --Xcc="-lm"

Works! Great! Thank you!

Nice to hear. I commited the small modifications to the master branch.