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包含所有的规格()。目录文件),并且libddsadad包含所有的目录文件:

       -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 

为什么它需要实际的主体文件?specs + .a文件还不够吗?我怎样才能规避这个问题呢?

规格和存档库是不够的。您需要指定.ali文件的位置。此外,请尝试使用-aI和-aL标志而不是-I。

您需要指定:

-largs switches:链接开关,其中switchesgnatlink的有效开关列表。

-Ldir:将目录dir添加到链接器搜索库的目录列表中。

例如,

-largs -L/lib/Linux/ndds.4.5d/lib/GNATgcc/static/debug -lnddsadad

附录:你也可以看

-Adir:相当于-aLdir -aIdir

您可以为库创建一个gnat项目文件,如下所示:

project DDS_Lib is
   for Source_Dirs use ("/usr/include/dds_path");
   for Library_Name use "nddsadad";
   for Library_Dir use "/usr/lib/dds_path";
   for Library_ALI_Dir use "/usr/lib/dds_ali_path";
   for Externally_Built use "true";
end DDS_Lib;

,然后在项目文件中,在开头添加with "dds_lib.gpr";。你不需要在你的链接器标志中添加任何东西来链接这个库,因为它是自动完成的。

优秀的Ada库已经提供了这样一个gpr文件,它应该安装在标准搜索路径中(例如/usr/lib/gnat/)。如果安装在非标准路径,可以将路径添加到ADA_PROJECT_PATH环境变量中。

最新更新