如何在不安装IDE的情况下编译和运行此Delphi代码? [英] How to compile and run this Delphi code without installing an IDE?

查看:60
本文介绍了如何在不安装IDE的情况下编译和运行此Delphi代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据说生成一个winform:

It's say to generate a winform:

var
  F : TForm;
  L : TLabel;
begin
  F := TForm.Create(Application);
  L := TLabel.Create(F);
  L.Parent := F; // Needed to have it show up on the form.
  L.Left := 50;
  L.Top := 50;
  L.Caption := 'This is an example';
  F.Show;
end;

实际上它来自我的上一个问题.

如果是C程序,我可以这样运行:

If it's C programme, I can run it this way:

> gcc foo.c -o foo.exe
> foo.exe

我该如何在Delphi中类似地做到这一点?

How can I do it similarly in Delphi?

推荐答案

要编译Delphi代码,您需要一个编译器.不再有免费的Delphi版本,因此,除非您找到旧版本,否则您必须购买Delphi.Delphi带有gcc之类的命令行编译器,可以在没有IDE的情况下编译程序.

In order to compile Delphi code you would need a compiler. There are no free versions available of Delphi anymore so unless you can find an old one you would have to buy Delphi. Delphi comes with a commandline compiler like gcc and can compile programs without an IDE.

Delphi 2006和Win32之前的版本:

Delphi 2006 and before win32:

dcc32 YourProject.dpr

Delphi 2006以及.Net之前的版本:

Delphi 2006 and before .Net:

dccil YourProject.dpr

Delphi 2007及之后的版本:

Delphi 2007 and after:

msbuild YourProject.dproj

这将生成一个已编译的二进制文件,如果是EXE,则可以像以前一样运行它.

This will result in a compiled binary and in case of an EXE you can run it like you are used to.

Delphi有免费的替代软件,例如 FreePascal 及其免费的IDE

There are free alternatives to Delphi like FreePascal and their free IDE Lazarus. I haven't checked for myself but I am pretty sure it comes with a commandline compiler as well.

这篇关于如何在不安装IDE的情况下编译和运行此Delphi代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆