使用glib.h在GPS(Ada IDE)中编译故障

时间:2012-11-20 18:29:11

标签: ada glib

我在尝试在GPS中编译Ada代码时遇到了一些麻烦。当我将它包含在包装上时,GPS说缺失了。我尝试使用apt-get进行安装,但确实如此,但错误仍然存​​在。我接下来该怎么办?我在x64 Ubuntu 12.04上运行GPS。

以下是我收到的错误消息:

gprbuild -d -P/media/LUISMUNYOZ/QUINTO/str/pendulum/pendulum_portatil/pendulum.gpr
 -XEXTRA=True -XOPENGL=True -XGNOME=True -XBUILD=Production
 print_barrier_sync.adb contrib.gpr:1:09: warning: no compiler specified for language "Xml",
 ignoring all its sources x86_64-pc-linux-gnu-gcc -c lw.c In file included from
 /media/LUISMUNYOZ/QUINTO/str/pendulum/pendulum_portatil/gtkada/testgtk/opengl/lw.c:20:0:
 /media/LUISMUNYOZ/QUINTO/str/pendulum/pendulum_portatil/gtkada/testgtk/opengl/lw.h:23:18:
 fatal error: glib.h: No such file or directory compilation terminated.
 gprbuild:* compilation phase failed

[2012-11-21 13:24:47] process exited with status 4 (elapsed time: 02.06s) [2012-11-21 13:24:56]
    Could not locate executable on path: svn SVN error:
[…]

此时错误触发:

#ifndef LW_H
#define LW_H

#include <glib.h>           <------------------------------------------
#include <GL/gl.h>

#define LW_MAX_POINTS   200
#define LW_MAX_NAME_LEN 500

文件是lw.h,它在包GtkAda中定义。我从GPS页面下载了它。

2 个答案:

答案 0 :(得分:3)

我会追求@ Simon的approach,但基于2.4.2. Using the command line的解决方案可能是一个临时替代方案,而你可以解决潜在的问题。

当您使用Linux时,这里是基本Interaction演示的Makefile

# 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) 

作为参考,这些软件包安装在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

答案 1 :(得分:2)

我从未使用过GtkAda。但是...我用Google搜索了glib.h并获得了很多点击,建议对于普通的C版本,应该使用 - 例如,来自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)

但是,我们在这里谈gprbuild,所以也许GtkAda documentation是相关的?它表示您需要在GNAT项目文件中包含with "gtkada";,并在gtkada.gpr上包含ADA_PROJECT_PATH的位置(如果它不存在)(请参阅{{1}的输出})。

如果您已经这样做了,请向我们展示GPR文件。