在社区编译器 25.0w 中使用 ADA 程序的 .gpr 文件中的开关

问题描述 投票:0回答:1

我正在使用“构建和调试”编译程序并收到以下错误消息:

[2024-12-12 11:24:45] 无法确定文件的项目:D: da\project\Sudoku\Sudoku_main.gpr
[2024-12-12 11:24:45] 无法在命令行中扩展参数:%fp
[2024-12-12 11:24:45] 构建命令未启动。

我正在使用以下 .gpr 文件:

with "gtkada";

project Sudoku_main is
   for Object_Dir use "./build";
   for Exec_Dir use "./execute";
   type Build_Kind is ("static", "relocatable");
   Library_Type : Build_Kind := external ("LIBRARY_TYPE", "static");
   case Library_Type is
      when "static" =>
         for Source_Dirs use ("./src",
                              "../../Standaarden/Standaard Packages/Pipe/",
                              "../../Standaarden/Standaard Packages/Init/",
                              "../../Standaarden/Standaard Packages/Strings/");
         -- "../../Standaarden/Standaard Packages/Debugging/");
         for Main use ("Sudoku_main.adb");
      when "relocatable" =>
   end case;
   package Ide is
      for Documentation_Dir use "./doc";
   end Ide;
   package Builder is
      case Library_Type is
         when "static" =>
            for Default_Switches ("ada") use ("-s", "-m", "-j4", "-g");
         when "relocatable" => for Default_Switches ("ada") use ("-s");
      end case;
   end Builder;
   package Compiler is
      case Library_Type is
         when "static" =>
            for Default_Switches ("ada") use ("-gnatQ", "-g", "-gnata", "-gnatf");
         when "relocatable" =>
            for Default_Switches ("ada") use ("-O2");
      end case;
   end Compiler;
   package Linker is
      -- for Windows production only ;; remove for Linux / Mac / Win debug
      case Library_Type is
         when "static" =>
            for Default_Switches ("ada") use ("-mwindows", "-g");
         when "relocatable" =>
            for Default_Switches ("ada") use ("-mwindows");
      end case;
   end Linker;
end Sudoku_main;

程序无法启动,我怀疑与开关有关

ada gnat
1个回答
0
投票

我认为你混淆了 gprbuild,因为混淆了库和可执行文件的样式。

尝试:

for Source_Dirs
for Main
子句移至顶部。

删除从

type Build_Kind
end Case
剩余的与图书馆相关的内容。

package Build
中,选择您想要的开关并使用它们。

同样在

package Compiler
package Linker

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.