1

I am getting the following error using xcode with pascal:

warning: It seems your project only contains units and no main program

What causes this warning? And how do I set the main program?

I am using: Xcode 4.5.2, Free Pascal Compiler version 2.6.0, and Mac OSX 10.8.

4

1 回答 1

0

如果我正确理解了这个问题,那么您将错过.dpr告诉编译器应该构建什么类型的项目的(项目文件)。Delphi(以及之前的 Borland Pascal 和 Turbo Pascal 编译器)的项目文件通常如下所示:

{ For a GUI (Windows) application }
program MyProgram;

uses
  Forms,
  main in 'main.pas' {fMain};

{$R *.RES}

begin
  Application.Initialize;
  Application.CreateForm(TfMain, fMain);
  Application.Run;
end.

{ For a console application }
program MyProgram;
{$APPTYPE CONSOLE }    

uses
  MyMain, SysUtils;

begin
  try
    { 
       Execute your application's entry point (main()) here, in this case
       contained in MyMain.pas that's listed in the uses clause above.
    }
  except
    { Handle any exception here }
  end;
end.

然后在 Delphi XE2 中运行dpr2xcode.exe以创建相应的 Xcode 项目。(我不知道 FreePascal 中的相应步骤是什么,但您可能会在 FP 安装中寻找类似的内容。)在 Mac 上打开该.xcodeproj文件Xcode,然后运行或调试代码。

有关使用 FreePascal 和 Xcode 的具体信息,我推荐 Phil Hess 的一系列文章

于 2013-01-23T16:47:09.460 回答