Version française
Home     About     Download     Resources     Contact us    
Browse thread
compiling multifile program
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Lyn A Headley <laheadle@m...>
Subject: compiling multifile program
ok, so I tried to compile the simplest multifile program I could
think of, and I still get the "Undefined Global" error.  The files
are entry2.ml[i], qstring2.ml[i], and response2.ml

file entry2.ml:
let ent () = "hey";;

file entry2.mli:
val ent: unit -> string;;

file qstring2.ml:
let str () = "hi";;

file qstring2.mli:
val str: unit -> string;;

the "main file" response2.ml:
let s1 = Qstring2.str() and
    e1 = Entry2.ent() in
3;;

The error is:

Error while linking response2.cmo: Reference to undefined global `Qstring2'
make: *** [all] Error 2

If anyone could help, I would much appreciate it.
ocaml 1.04 SGI Irix 5.2

Lyn Headley

In case it should matter, Here's the Makefile:

OCC=ocamlc
OCDEP=ocamldep
INCLUDES= #all relevant -I options here
OCFLAGS=$(INCLUDES) -custom str.cma response2.ml unix.cma -cclib -lunix -cclib -lstr
# quiz should be compiled to bytecode, and is composed of three
# units: mod1, mod2 and mod3.

# Common rules
.SUFFIXES: .ml .mli .cmo .cmi

.mli.cmi:
        $(OCC) -c $<

.ml.cmo:
        $(OCC) -c $<

QUIZ_OBJS= entry2.cmo qstring2.cmo

all: $(QUIZ_OBJS)
        $(OCC) $(OCFLAGS) $(QUIZ_OBJS)

clean:
        rm -f *.cm[iox]

depend:
        $(OCDEP) $(INCLUDES) *.mli *.ml > .depend


include .depend