简体   繁体   中英

Ocaml and eclipse with ocalIDE get a syntaxe error on #use command

I use ocalIDE as ocaml plugin in eclipse but on every #use foo line I got a

syntax error: unexpected token "#". 

If I run this exact file in the toplevel windows it's working well, but I can't use the plugin tool (type info and auto-complete mainly) as it cannot compile my file.

Have you got any Idea why it cannot compile? I've got myFile.byte in the project parameter and without the #use line it's compile (well once I remove all what cannot work as the 'use' file isn't included...)

#use and other # -directives are not part of the Ocaml language, they are instructions specifically for the toplevel . Since you can't use them in Ocaml source code, it's not surprising that tools designed to work on Ocaml source code won't cope with them.

To use a function (or type, etc.) from a module , just write Modulename.function (eg List.hd [1; 2] ). If you want to use functions from a module without having to repeat the module name, use the open keyword (eg open Unix ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM