为什么ocamlfind找不到安装的库(camlp4)

时间:2015-07-11 07:33:57

标签: ocaml ocamlfind

我安装了OCaml库。为了证明我有这个:

procedure TformOptions.FormCreate(Sender: TObject);
var
  lib: THandle;
  icon: TIcon;
begin
  icon := TIcon.Create;
  lib := LoadLibrary('res.dll');
  if lib > 0 then icon.Handle := LoadIcon(lib, 'ICON2');
  if icon.Handle > 0 then Application.Icon.Assign(icon);
  icon.Free;
  FreeLibrary(lib);
end;

而且:

$ ~/.opam/bin/opam install camlp4
[NOTE] Package camlp4 is already installed (current version is 4.02+system).

但是当我尝试这个时,它无法识别文件

$ ls `ocamlc -where`/camlp4*
Camlp4.cmi     Camlp4Bin.cmx  Camlp4Parsers   Camlp4Top.cmi      camlp4fulllib.a     camlp4lib.a     camlp4o.cma    camlp4orf.cma   camlp4prof.cmx  camlp4rf.cma
Camlp4Bin.cmi  Camlp4Bin.o    Camlp4Printers  Camlp4Top.cmo      camlp4fulllib.cma   camlp4lib.cma   camlp4of.cma   camlp4prof.cmi  camlp4prof.o
Camlp4Bin.cmo  Camlp4Filters  Camlp4Top       Camlp4_config.cmi  camlp4fulllib.cmxa  camlp4lib.cmxa  camlp4oof.cma  camlp4prof.cmo  camlp4r.cma

如何启用它?

我的$ ocamlfind query camlp4 ocamlfind: Package `camlp4' not found 看起来像这样:

~/.ocamlinit

1 个答案:

答案 0 :(得分:1)

您可能忘记使用

激活您的opam环境
 eval $(opam config env) 

命令。而且您正在尝试使用系统编译器进行编译,即系统包管理器安装的编译器