2010-07-30 42 views
0

我只是在我的Lazarus上編碼,沒有改變TForm聲明中的任何內容。然後我試圖測試我的應用程序,但在編制我得到這個錯誤:重複的標識符錯誤

TomAct.lpr(11,43) Error: Duplicate identifier "TOMACT" 
TomAct.lpr(15,32) Error: Identifier not found "TForm1" 
TomAct.lpr(15,39) Error: Identifier not found "Form1" 
TomAct.lpr(19) Fatal: There were 3 errors compiling module, stopping

這裏是我的* .lpr文件的內容:

program TomAct; 

{$mode objfpc}{$H+} 

uses 
    {$IFDEF UNIX}{$IFDEF UseCThreads} 
    cthreads, 
    {$ENDIF}{$ENDIF} 
    Interfaces, // this includes the LCL widgetset 
    Forms 
    { you can add units after this }, TomAct; 

begin 
    Application.Initialize; 
    Application.CreateForm(TForm1, Form1); 
    Application.Run; 
end. 

我需要做什麼?

回答

1

顯然,有一個名爲TomAct單元,但你的項目也被命名TomAct。爲您的項目或表單定義的單位選擇一個不同的名稱。

關於重複標識符的第一個錯誤是因爲編譯器認爲您正在嘗試「使用」項目本身,這是不允許的。它發出錯誤消息並繼續編譯而不使用該單元。

未聲明的標識符錯誤是第一個錯誤的副作用。由於該單元尚未使用,因此編譯器不知道其中聲明的類型和變量。

+0

好吧,但我如何重命名項目名稱而不會導致其他問題?因爲它不僅僅是重命名* .lpr文件。 – 2010-07-31 11:27:21

+1

Lazarus在文件菜單中有沒有「另存爲」命令?德爾福就是這樣做的。 – 2010-07-31 16:37:03

+0

我仍然收到相同的錯誤。 **:(** – 2010-07-31 19:51:50