I am compiling a program with “Build & debug” and get the following error message:
[2024-12-12 11:24:45] Could not determine the project for file: D:adaprojectSudokuSudoku_main.gpr
[2024-12-12 11:24:45] Could not expand argument in command line: %fp
[2024-12-12 11:24:45] Build command not launched.
I am using following .gpr file:
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;
The program will not start; I suspect it has something to do with the switches.
1
I think you’ve confused gprbuild by mixing up library and executable styles.
Try:
Move the for Source_Dirs
and for Main
clauses to the top.
Get rid of the remaining library-delated stuff from type Build_Kind
to end Case
.
In package Build
, choose which switches you want and just use them.
Likewise in package Compiler
, package Linker
.