导出同一库中的模块时出现CoqIDE错误

导出同一库中的模块时出现CoqIDE错误,coq,coqide,Coq,Coqide,我正在运行CoqIDE来阅读教科书系列“软件基础”,我目前正在阅读“逻辑基础”一卷。我刚开始读第二章(归纳法),但当我试着运行这一行时 From LF Require Import Basics. 我得到一个错误声明 文件…\LF\Basics.vo包含库 基础知识,而不是图书馆基础知识 我尝试重命名文件所在的目录,并重新编译缓冲区,但这两个操作都没有帮助。为了解决这个问题,我应该怎么做?我们一直在改进即将发布的新版LF中的解释。以下是相关位: For the [Require Export

我正在运行CoqIDE来阅读教科书系列“软件基础”,我目前正在阅读“逻辑基础”一卷。我刚开始读第二章(归纳法),但当我试着运行这一行时

From LF Require Import Basics.
我得到一个错误声明

文件…\LF\Basics.vo包含库
基础知识,而不是图书馆基础知识


我尝试重命名文件所在的目录,并重新编译缓冲区,但这两个操作都没有帮助。为了解决这个问题,我应该怎么做?

我们一直在改进即将发布的新版LF中的解释。以下是相关位:

For the [Require Export] to work, Coq needs to be able to
find a compiled version of [Basics.v], called [Basics.vo], in a directory
associated with the prefix [LF].  This file is analogous to the [.class]
files compiled from [.java] source files and the [.o] files compiled from
[.c] files.

First create a file named [_CoqProject] containing the following line
(if you obtained the whole volume "Logical Foundations" as a single
archive, a [_CoqProject] should already exist and you can skip this step):

  [-Q . LF]

This maps the current directory ("[.]", which contains [Basics.v],
[Induction.v], etc.) to the prefix (or "logical directory") "[LF]".
PG and CoqIDE read [_CoqProject] automatically, so they know to where to
look for the file [Basics.vo] corresponding to the library [LF.Basics].

Once [_CoqProject] is thus created, there are various ways to build
[Basics.vo]:

 - In Proof General: The compilation can be made to happen automatically
   when you submit the [Require] line above to PG, by setting the emacs
   variable [coq-compile-before-require] to [t].

 - In CoqIDE: Open [Basics.v]; then, in the "Compile" menu, click
   on "Compile Buffer".

 - From the command line: Generate a [Makefile] using the [coq_makefile]
   utility, that comes installed with Coq (if you obtained the whole
   volume as a single archive, a [Makefile] should already exist
   and you can skip this step):

     [coq_makefile -f _CoqProject *.v -o Makefile]

   Note: You should rerun that command whenever you add or remove Coq files
   to the directory.

   Then you can compile [Basics.v] by running [make] with the corresponding
   [.vo] file as a target:

     [make Basics.vo]

   All files in the directory can be compiled by giving no arguments:

     [make]

   Under the hood, [make] uses the Coq compiler, [coqc].  You can also
   run [coqc] directly:

     [coqc -Q . LF Basics.v]

   But [make] also calculates dependencies between source files to compile
   them in the right order, so [make] should generally be prefered over
   explicit [coqc].

If you have trouble (e.g., if you get complaints about missing
identifiers later in the file), it may be because the "load path"
for Coq is not set up correctly.  The [Print LoadPath.] command
may be helpful in sorting out such issues.

In particular, if you see a message like

    [Compiled library Foo makes inconsistent assumptions over
    library Bar]

check whether you have multiple installations of Coq on your machine.
It may be that commands (like [coqc]) that you execute in a terminal
window are getting a different version of Coq than commands executed by
Proof General or CoqIDE.

- Another common reason is that the library [Bar] was modified and
  recompiled without also recompiling [Foo] which depends on it.  Recompile
  [Foo], or everything if too many files are affected.  (Using the third
  solution above: [make clean; make].)

One more tip for CoqIDE users: If you see messages like [Error:
Unable to locate library Basics], a likely reason is
inconsistencies between compiling things _within CoqIDE_ vs _using
[coqc] from the command line_.  This typically happens when there
are two incompatible versions of [coqc] installed on your
system (one associated with CoqIDE, and one associated with [coqc]
from the terminal).  The workaround for this situation is
compiling using CoqIDE only (i.e. choosing "make" from the menu),
and avoiding using [coqc] directly at all. *)

非常感谢您的回复。我看完了你的评论。在我的系统中,一切都遵循您评论的规范。我只安装了一个Coq,我下载了Coq作为归档文件,因此_Coqproject存在,并在其中存储了正确的行,Basics.vo存在,我仅从CoqIDE编译Coq。我认为_Coqproject没有正确运行,因为我收到的错误消息是Basics而不是LF.Basics存在。你知道我能做些什么来解决这个问题吗?我想我忘记了在编译缓冲区之前或之后在基础上运行“make”,但现在它可以工作了。非常感谢你的帮助。我认为最好在书的前面写上这个暗示。当我尝试测试我在“基础”一章中的练习时,我遇到了这个问题。