English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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: 1997-04-14 (15:15)
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

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:

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

        $(OCC) -c $<

        $(OCC) -c $<

QUIZ_OBJS= entry2.cmo qstring2.cmo

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

        rm -f *.cm[iox]

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

include .depend