users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Using C++ with the gplc compiler


From: Jay Bradley
Subject: Using C++ with the gplc compiler
Date: Mon, 19 Feb 2001 23:56:37 +0000

Sorry to pester everyone on the list again.

Thankyou Fergus for the help. I've managed to get the C++ libraries linked in 
but I'm having difficulty linking in the prolog stuff. I've tried linking in 
all of the libraries in the gprolog distribution but to no avail.

I now have the following, slightly better, situation:

The makefile:

three: threeBrain.o threeBody.o
        gplc -v -o three.robot threeBrain.o threeBody.o -L -lstdc++

threeBrain.o: threeBrain.pl
        gplc -c threeBrain.pl -o threeBrain.o -v

threeBody.o: threeBody.cc
        gplc -v --c-compiler g++ -c threeBody.cc -o threeBody.o -C 
-I/usr/local/gprolog-1.2.1/include/

        
The output:

address@hidden robots]$ make three
gplc -c threeBrain.pl -o threeBrain.o -v
Prolog compiler (GNU Prolog) 1.2.1
By Daniel Diaz
Copyright (C) 1999,2000 Daniel Diaz
GNU Prolog comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Prolog
under the terms of the GNU General Public License.
For more information about these matters, see the files named COPYING.

Path used: /usr/local/gprolog-1.2.1

*** Compiling

--- file: threeBrain.pl
pl2wam -o /tmp/gplcMwp8Yc.wam threeBrain.pl
wam2ma -o /tmp/gplcM9wDri.ma /tmp/gplcMwp8Yc.wam
delete /tmp/gplcMwp8Yc.wam
ma2asm -o /tmp/gplcuX4gIn.s /tmp/gplcM9wDri.ma
delete /tmp/gplcM9wDri.ma
as -o threeBrain.o /tmp/gplcuX4gIn.s
delete /tmp/gplcuX4gIn.s



gplc -v --c-compiler g++ -c threeBody.cc -o threeBody.o -C 
-I/usr/local/gprolog-1.2.1/include/
Prolog compiler (GNU Prolog) 1.2.1
By Daniel Diaz
Copyright (C) 1999,2000 Daniel Diaz
GNU Prolog comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Prolog
under the terms of the GNU General Public License.
For more information about these matters, see the files named COPYING.

Path used: /usr/local/gprolog-1.2.1

*** Compiling

--- file: threeBody.cc
g++ -I/usr/local/gprolog-1.2.1/include/ -mpentiumpro -malign-loops=2 
-malign-jumps=2 -malign-functions=2 -ffixed-ebx -c 
-I/usr/local/gprolog-1.2.1/include -o threeBody.o threeBody.cc
In file included from /usr/include/iostream.h:31,
                 from threeBody.cc:6:
/usr/include/streambuf.h: In method `ios::~ios()':
/usr/include/streambuf.h:485: warning: `void *' is not a pointer-to-object 
type




gplc -v -o three.robot threeBrain.o threeBody.o -L -lstdc++
Prolog compiler (GNU Prolog) 1.2.1
By Daniel Diaz
Copyright (C) 1999,2000 Daniel Diaz
GNU Prolog comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Prolog
under the terms of the GNU General Public License.
For more information about these matters, see the files named COPYING.

Path used: /usr/local/gprolog-1.2.1

*** Compiling

*** Linking

gcc -lstdc++  -o three.robot /usr/local/gprolog-1.2.1/lib/obj_begin.o 
threeBrain.o threeBody.o /usr/local/gprolog-1.2.1/lib/all_pl_bips.o 
/usr/local/gprolog-1.2.1/lib/all_fd_bips.o 
/usr/local/gprolog-1.2.1/lib/top_level.o 
/usr/local/gprolog-1.2.1/lib/debugger.o 
/usr/local/gprolog-1.2.1/lib/libbips_fd.a 
/usr/local/gprolog-1.2.1/lib/libengine_fd.a 
/usr/local/gprolog-1.2.1/lib/libbips_pl.a 
/usr/local/gprolog-1.2.1/lib/obj_end.o 
/usr/local/gprolog-1.2.1/lib/libengine_pl.a 
/usr/local/gprolog-1.2.1/lib/liblinedit.a -lm 
threeBody.o: In function `main':
threeBody.o(.text+0xb5): undefined reference to `Start_Prolog(int, char **)'
threeBody.o(.text+0xc5): undefined reference to `Find_Atom(char *)'
threeBody.o(.text+0xe2): undefined reference to `Pl_Query_Start(int, int, long 
*, int)'
threeBody.o(.text+0xf6): undefined reference to `Pl_Query_End(int)'
threeBody.o(.text+0xfe): undefined reference to `Reset_Prolog(void)'
threeBody.o(.text+0x10d): undefined reference to `Stop_Prolog(void)'
collect2: ld returned 1 exit status
compilation failed
deleting temporary files before exit
make: *** [three] Error 1
address@hidden robots]$

As you can see I've linked in all the libraries in the gprolog-1.2.1/lib 
directory but this has no effect. The references are still undefined.
If anybody knows the whereabouts of the library to link or any other reason 
why the functions aren't being linked in I'd be grateful of the help.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]