2012-11-20 41 views
2

我在嘗試編譯GPS中的Ada代碼時遇到了一些麻煩。當我將GPS包含在軟件包中時,GPS缺失。我嘗試使用apt-get進行安裝,但確實如此,但錯誤仍然存​​在。接下來我可以做什麼?我在x64 Ubuntu 12.04上運行GPS。使用glib.h在GPS(Ada IDE)中編譯時出現的問題

這裏的錯誤消息我:

 
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頁面下載了它。

+1

讓我們看看你有麻煩的代碼,你得到了錯誤的信息。在你這樣做之前,我們無法幫助你。 –

+0

@SimonWright對不起,我張貼從我的智能手機。我做了你所說的。感謝和問候。 – lluisu

回答

3

我會追求@西蒙的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 
2

我從來沒有用過GtkAda。但是...我一派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 [email protected] $(LDFLAGS) 

然而,我們在這裏談論gprbuild,所以也許GtkAda documentation相關?它說,你需要在你的GNAT項目文件with "gtkada";,幷包括gtkada.gpr位置上的ADA_PROJECT_PATH,如果它不存在的話(見gnatls -v輸出)。

如果你已經這樣做了,請告訴我們的GPR文件。