Re: Problem when compiling a simple C-- program

Christof Douma <[email protected]>
Newsgroups gmane.comp.lang.c--
Message-ID <[email protected]>
Hi.

> sp2.o(.data+0x0): In function `Cmm.ref_to_global_area':
> : undefined reference to `Cmm.globalsig.aQOYZWMPACZAJaMABGMOZeCCPY'
Use the -globals option.

> ../sysdeps/i386/elf/start.S:98: undefined reference to `main'
To link the object into an executable make a main function with the "C"
calling convention.

export main;
foreign "C" main(bits32 argc, "address" bits32 argv) {
	bits32 x, y;
	x, y = sp2(5);
	foreign "C" return(0);
}

cheers,
Christof

On Thu, Mar 31, 2005 at 07:49:54PM +0200, Peter BARABAS wrote:
> Good day,
> 
> I have a file named sp2.cmm:
> 
> target
>     memsize 8
>     byteorder little
>     pointersize 32
>     wordsize 32;
> 
> export sp2;
> 
> sp2(bits32 n) {
>   jump sp2_help(n, 1, 1);
> }
> 
> sp2_help(bits32 n, bits32 s, bits32 p) {
>   if n == 1 {
>       return(s, p);
>   } else {
>       jump sp2_help(n-1, s+n, p*n);
>   }
> }
> 
> This is how I try to compile it:
> 
> qc-- sp2.cmm
> 
> and this is what I get:
> 
> 
> Though sp2.o and sp2.s gets created. What can cause that error
> message? These are my system's parameters:
> 
> QC version: latest, qc--20050330
> Debian sid
> kernel: 2.4.27
> Ocaml: 3.08.3
> LUA: 4.0
> 
> ldd gc-- gives:
>         libm.so.6 => /lib/libm.so.6 (0x40020000)
>         libdl.so.2 => /lib/libdl.so.2 (0x40042000)
>         libncurses.so.5 => /lib/libncurses.so.5 (0x40045000)
>         libpthread.so.0 => /lib/libpthread.so.0 (0x40085000)
>         libc.so.6 => /lib/libc.so.6 (0x400d6000)
>         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
> 
> Thank you in advance.
> 
> -- 
> '(Yours parenthetically),
> peter barabas.
> 
> ((call/cc call/cc) (call/cc call/cc))
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.