Ada 编译问题(正在寻找我没有的 adb?)
我正在尝试使用 gnatmake 将第三方库编译到我现有的应用程序中。我收到此错误:
gnatmake: "dds.adb" not found
gnatmake: "dds-domainparticipant.adb" not found
gnatmake: "dds-domainparticipantfactory.adb" not found
gnatmake: "dds-publisher.adb" not found
gnatmake: "dds-topic.adb" not found
gnatmake: "dds-publisher_impl.adb" not found
gnatmake: "dds-datawriter_impl.adb" not found
gnatmake: "dds-domainparticipant_impl.adb" not found
gnatmake: "dds-readcondition_impl.adb" not found
gnatmake: "dds-datareader_impl.adb" not found
gnatmake: "dds-subscriber.adb" not found
gnatmake: "dds-condition.adb" not found
gnatmake: "dds-datareader.adb" not found
gnatmake: "dds-statuscondition.adb" not found
我将这些添加到构建 adp 的 gnatmake 中。 -I 包含所有规范(.ads 文件),libnddsadad 包含所有 o 文件:
-I/lib/ndds.4.5d/include/ndds/dds_ada \
-I/lib/ndds.4.5d/include/ndds/dds_ada/support \
-I/lib/ndds.4.5d/include/ndds/dds_ada/support/low-level \
/lib/Linux/ndds.4.5d/lib/GNATgcc/static/debug/libnddsadad.a \
为什么它需要实际的正文文件?规格+ .a 文件还不够吗?我怎样才能规避这个问题?
I am trying to compile a third part library into my existing application using gnatmake.. And I am getting this error:
gnatmake: "dds.adb" not found
gnatmake: "dds-domainparticipant.adb" not found
gnatmake: "dds-domainparticipantfactory.adb" not found
gnatmake: "dds-publisher.adb" not found
gnatmake: "dds-topic.adb" not found
gnatmake: "dds-publisher_impl.adb" not found
gnatmake: "dds-datawriter_impl.adb" not found
gnatmake: "dds-domainparticipant_impl.adb" not found
gnatmake: "dds-readcondition_impl.adb" not found
gnatmake: "dds-datareader_impl.adb" not found
gnatmake: "dds-subscriber.adb" not found
gnatmake: "dds-condition.adb" not found
gnatmake: "dds-datareader.adb" not found
gnatmake: "dds-statuscondition.adb" not found
I added these to the gnatmake which builds the adp. The -I contains all of the specs (.ads files), and the libnddsadad has all of the o files:
-I/lib/ndds.4.5d/include/ndds/dds_ada \
-I/lib/ndds.4.5d/include/ndds/dds_ada/support \
-I/lib/ndds.4.5d/include/ndds/dds_ada/support/low-level \
/lib/Linux/ndds.4.5d/lib/GNATgcc/static/debug/libnddsadad.a \
Why does it want the actual body files? Shouldn’t the specs + .a file be enough? How can I circumvent this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
规格和档案库还不够。您需要指定 .ali 文件的位置。另外,尝试使用 -aI 和 -aL 标志而不是 -I。
Specs and an archive library are not enough. You need to specify the location of the .ali files. Also, try using the -aI and -aL flags instead of -I.
您需要指定:
-largs 开关
:链接器开关,其中switches
是有效开关的开关列表gnatlink
。-Ldir
:将目录dir
添加到链接器将在其中搜索库的目录列表中。例如,
附录:您还可以查看
-Adir
:相当于-aLdir -aIdir
。You need to specify:
-largs switches
: Linker switches, whereswitches
is a list of switches that are valid switches forgnatlink
.-Ldir
: Add directorydir
to the list of directories in which the linker will search for libraries.For example,
Addendum: You might also look at
-Adir
: Equivalent to-aLdir -aIdir
.您可以为该库创建一个 gnat 项目文件,如下所示:
然后在项目文件中,在开头添加
with "dds_lib.gpr";
。您不必向链接器标志添加任何内容即可与此库链接,因为它是自动完成的。好的 Ada 库已经提供了这样的 gpr 文件,该文件应该安装在标准搜索路径(例如 /usr/lib/gnat/)中。如果安装在非标准路径,您可以将该路径添加到
ADA_PROJECT_PATH
环境变量中。You could create a gnat project file for the library, something like this:
and then in your project file, add
with "dds_lib.gpr";
at the beginning. You don't have to add anything to your Linker flags to link with this library, since it is done automagically.Good Ada libraries already provide such a gpr file, which should get installed in the standard search path (for example /usr/lib/gnat/). If it is installed at a non-standard path, you can add the path to the
ADA_PROJECT_PATH
environment variable.