gm2
[Top][All Lists]
Advanced

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

Re: [Gm2] First time user needs help


From: Gaius Mulley
Subject: Re: [Gm2] First time user needs help
Date: Tue, 19 Oct 2010 17:12:09 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Chris Lilley <address@hidden> writes:

> On Tuesday, October 19, 2010, 4:38:24 AM, Duke wrote:
>
> DN> Hello List....
> Hi
>
> DN> gm2 FirstEx.mod
> DN> /tmp/cc88QDty.a(ccCMkDYZstart.o): In function `init(int, char**)':
> DN> cc8SWNIx.cpp:(.text+0x2b0): undefined reference to `_M2_FirstEx_init'
> DN> /tmp/cc88QDty.a(ccCMkDYZstart.o): In function `finish()':
> DN> cc8SWNIx.cpp:(.text+0x301): undefined reference to
> DN> `_M2_FirstEx_finish'
> DN> collect2: ld returned 1 exit status
>
> Like you, I recently took first steps with gm2 (not first with modula-2) and 
> like you, I assumed that gm2 foo.mod would work.
>
> However, at this stage, the gcc environment does not 'know' about the 
> modula-2 language in the same way that it knows about C, C++, F77, Ada etc.
>
> So
>
> gm2 -c -g -I. foo.mod
>
> tells it to compile
>
> DN> gm2 -c FirstEx.mod
>
> DN> compiles the above code to FirstEx.o, which I'm taking for granted is
> DN> correct. 
>
> Yes. 
>
> Actually I don't really understand what the -g -I. does, I just copied them 
> from
> http://www.nongnu.org/gm2/gm2.html#SEC6

Hi,

the -I. says look in the current directory for definition modules before
looking in the system directories (this the default).  The -g option
turns on generation of symbolic debugging information so that gdb can
make sense of the source code.

gm2 needs the option '-c' to compile
as without '-c' it only links the module.  Also a module name must match
its filename.

So with your example:

$ gm2 -c FirstEx.mod
$ gm2 FirstEx.mod
$ ./a.out

should work - hope this helps,

regards,
Gaius




>
> DN> So the linking process is getting hosed somewhere. What am I
> DN> missing, please? TIA...
>
>
> gm2 -g -I. FirstEx.mod
>
> will link and produce a.out which is executable. Use -o to get a different 
> executable filename.



reply via email to

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