Troubles compiling in GPS (Ada IDE) with glib.h

我是研究僧i 提交于 2019-12-02 00:57:55
trashgod

I'd pursue @Simon's approach, but a work-around based on 2.4.2. Using the command line might be a temporary alternative while you sort out the underlying problem.

As you are using linux, here's a Makefile for the basic Interaction demo.

# Make shared, static or debug targets.
OS := $(shell uname)
OBJ = obj
TARGET = interaction
GNATMAKE = gnatmake -D $(OBJ)
CARGS = -cargs -O3 -gnatp -gnatwu -gnatf
BARGS = -bargs
LARGS = -largs
.PHONEY: clean cleaner cleanest

all:
    @echo ""
    @echo "Build targets:"
    @echo ""
    @echo "    shared     Use the shared Ada libraries."
    @echo "    static     Link the Ada libraries statically."
    @echo "    debug      Enable debugging."
    @echo ""
    @echo "Support targets:"
    @echo ""
    @echo "    clean      Remove *.ali *.o b~.*"
    @echo "    cleaner    Remove target, too."
    @echo "    cleanest   Remove build directory, too."
    @echo ""

shared: $(OBJ)
shared: INCLUDE = $(shell gtkada-config --cflags)
shared: BARGS += -shared
shared: LARGS += $(shell gtkada-config --libs)
shared: LARGS += -dead_strip
shared: *.ad[sb]
    @echo "building with shared libraries:"
    $(GNATMAKE) $(TARGET) $(INCLUDE) $(CARGS) $(BARGS) $(LARGS)

static: $(OBJ)
static: INCLUDE = $(shell gtkada-config --static --cflags)
static: BARGS += -static
static: LARGS += $(shell gtkada-config --static --libs)
static: LARGS += -dead_strip
static: *.ad[sb]
    $(GNATMAKE) $(TARGET) $(INCLUDE) $(CARGS) $(BARGS) $(LARGS)

debug: $(OBJ)
debug: INCLUDE = $(shell gtkada-config --static --cflags)
debug: BARGS += -static
debug: LARGS += $(shell gtkada-config --static --libs)
debug: *.ad[sb]
    $(GNATMAKE) -g $(TARGET) $(INCLUDE) $(LARGS)

$(OBJ):
    mkdir $(OBJ)

clean:
    ${RM} $(OBJ)/* b~*

cleaner: clean
    ${RM} $(TARGET)

cleanest: cleaner
    ${RM} -r $(OBJ) 

For reference, these packages were installed on Ubuntu 12.04:

$ dpkg --get-selections | egrep "gnat|gtkada"
gnat                        install
gnat-4.6                    install
gnat-4.6-base               install
gnat-gps                    install
gnat-gps-common             install
gnat-gps-doc                install
libgnat-4.6                 install
libgnatprj4.6               install
libgnatvsn4.6               install
libgtkada-bin               install
libgtkada2.24.1             install
libgtkada2.24.1-dev         install
Simon Wright

I've never used GtkAda. However ... I googled glib.h and got many hits, suggesting that for plain C builds one should use - for example, from this StackOverflow question -

# Sample Makefile
CFLAGS := $(shell pkg-config --cflags glib-2.0 gtk+-2.0)
LDFLAGS := $(shell pkg-config --libs glib-2.0 gtk+-2.0)

foo: foo.c
        $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS)

However, we're talking gprbuild here, so perhaps the GtkAda documentation is relevant? It says you need to include with "gtkada"; in your GNAT Project file, and include the location of gtkada.gpr on your ADA_PROJECT_PATH if it isn't there already (see the output of gnatls -v).

If you've already done that, please show us the GPR file.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!