如何使用 Delphi 从命令行编译 Win32 程序
正如标题所说,我正在尝试在不借助IDE的情况下编译Win32程序,只是为了学习。我正在使用 Borland Studio 2006,我的第一个想法是从 IDE 中获取从 Forms 应用程序生成的一些文件并编译项目文件...这给了我关于期望单元和查找对象的错误。我知道它来自 dfm 文件,它保存了表单的所有设置,但我不明白 IDE 如何处理该文件,任何人都可以帮助我更好地理解系统吗? :)
as the title says, I'm trying to compile a Win32 program without the aid of an IDE, just so I can learn. I'm using Borland Studio 2006, and my first thought was to take some files generated from a Forms application from the IDE and compile the project file... that gave me errors about expecting unit and finding object instead. I know that's from the dfm file which holds all the settings for a form, but I don't get how the IDE deals with that file, can anyone help me understand the system better? :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果我理解正确的话,您需要掌握 Delphi 项目的结构以及表单和单元如何协同工作。您不能只是挑选一些文件并期望能够将它们提供给编译器。
您还必须设置库/组件/使用的文件的路径,以便编译器可以从项目 dpr 开始找到它需要的所有内容。
我建议您首先尝试从 IDE 运行您的项目,然后一旦运行,您可以从命令行尝试它。
If I have understood correctly, you need to grasp the structure of a Delphi project and how Forms and units work together. You cannot just cherry-pick some files and expect to be able to feed them to the compiler.
You also have to set the path to the library/components/used files so that the compiler can find everything it needs, starting with the project dpr.
I would recommend that you try first to run your project from the IDE, then once it runs, you can try it from the command line.
我发现我需要做的就是将顶级单元编译成 dcu,然后项目就会编译:) 如果其他人试图做同样的事情,本页底部有一些很棒的信息
http://www.codexterity.com/raw-delphi/index.htm
I found out all I needed to do is compile the top level unit into a dcu, and then the project will compile :) If anyone else is trying to do the same thing, there's some great info at the bottom of this page
http://www.codexterity.com/raw-delphi/index.htm
WANT 自动化构建、测试和打包应用程序和库的过程,就像 Jakarta Ant 所做的那样
WANT automates the process of building, testing, and packaging applications and libraries much like Jakarta Ant does
您在问题中写道,您正在使用 BDS 2006。如果您想了解 Delphi 中最新的构建过程,我建议您至少升级到 Delphi 2007,它引入了 MS Build 使用。
当然,MS Build 的作用就像“包装器”,所以这不是必须有的,但很好:-)
You wrote in question that you are using BDS 2006. If you want to learn more recent build process in Delphi I suggest you to upgrade at least to Delphi 2007 which introduced MS Build usage.
Of course MS Build acts like "wrapper" so this is not must have but nice have :-)