2014-04-23 3 views
2

기본적으로 Opam을 사용하여 Mac에서 lib 파생 라이브러리를 설치하려고합니다.Opam install derive, syntax error

opam install deriving 

나는 ocamlfind query을 사용하고있어 설치가 잘 된 것 같습니다.

다음
type stackop = PUSH | POP deriving (Show, Enum) 

let s = PUSH in 
    let s' = Show.show<stackop> s in 
    print_string s' 

가 _tags 파일입니다 : 설치 한 후

#ocamlfind query deriving                         
/Users/shuai/.opam/system/lib/deriving 

, 나는이 같은 간단한 코드를 컴파일 할 ocamlbuild 사용하려고 여기

<*> : package(unix), package(deriving) 

과하면 명령입니다

ocamlbuild -use-ocamlfind exp.native 

그러나 나는 항상

+ ocamlfind ocamldep -package unix -package deriving -modules exp.ml > exp.ml.depends 
File "exp.ml", line 1, characters 27-28: 
Error: Syntax error 
Command exited with code 2. 
Compilation unsuccessful after building 1 target (0 cached) in 00:00:00. 

이, 나는 구문이 올바른지 확인 아주 이상한 오전이 ..

사람이 나에게 어떤 도움을 줄 수 :이 오류가?

답변

3

deriving.syntax 패키지를 제공하는 것을 잊어 버린 것 같습니다.

사용하여 다음 _tags 파일 :

true: syntax(camlp4o) 
true: package(deriving,deriving.syntax) 
true: thread,debug,annot 
true: bin_annot 
+0

좋아! 작동합니다, Stas에게 감사합니다 :) – computereasy

+0

기본적으로'syntax (calp4o)'가 필요한 이유는 무엇입니까? – computereasy

+0

@computereasy 컴파일러에게 선처리 프로세서를 실행하도록 지시합니다. 파생은 구문 확장입니다. – Stas