Discussion:
compilation or linking error
(too old to reply)
ldries46
2024-11-30 08:22:51 UTC
Permalink
Using the 25.w0 compiler system on Windows 11 in a program using gtkada
I got the following error messages using the "Compile File"in the

[2024-11-30 08:42:53] Could not expand argument in command line: %rbt
[2024-11-30 08:42:53] Could not expand argument in command line: %rd
[2024-11-30 08:42:53] Build command not launched.

As said in the last line I cannot run  the program. Also missing the
chance to debug. This message contains the group file I use. Possibly
there is an error inside. I did control but the program is indeed not
running and not even the first line did not run shows that code is not
the problem. I included the used .gpr file and the base file of the
program. All the source files are in the directory /base./src while the
.gpr file is positioned in  /base.
Using the Check Syntax, Check Semantic and Compile File Show No Errors.
Run & debug show only some runtime failures message but never reaches
the start of the code :

Num     Type           Disp Enb Address            What
1       breakpoint     keep y   0x00000000004015a8 in sudoku_main at
D:\ada\project\Sudoku\src\sudoku_main.adb:44

What did I do wrong?
ldries46
2024-12-03 11:43:34 UTC
Permalink
I just run the Compile command and get:

[2024-12-03 12:28:45] Could not determine the project for file:
D:\ada\project\Sudoku\Sudoku_main.gpr
[2024-12-03 12:28:45] Could not expand argument in command line: %fp
[2024-12-03 12:28:45] Build command not launched.Op 30-11-2024 om 9:22
Post by ldries46
Using the 25.w0 compiler system on Windows 11 in a program using
gtkada I got the following error messages using the "Compile File"in the
[2024-11-30 08:42:53] Could not expand argument in command line: %rbt
[2024-11-30 08:42:53] Could not expand argument in command line: %rd
[2024-11-30 08:42:53] Build command not launched.
As said in the last line I cannot run  the program. Also missing the
chance to debug. This message contains the group file I use. Possibly
there is an error inside. I did control but the program is indeed not
running and not even the first line did not run shows that code is not
the problem. I included the used .gpr file and the base file of the
program. All the source files are in the directory /base./src while
the .gpr file is positioned in  /base.
Using the Check Syntax, Check Semantic and Compile File Show No
Errors. Run & debug show only some runtime failures message but never
Num     Type           Disp Enb Address            What
1       breakpoint     keep y   0x00000000004015a8 in sudoku_main at
D:\ada\project\Sudoku\src\sudoku_main.adb:44
What did I do wrong?
Max Reznik
2024-12-03 16:53:58 UTC
Permalink
It seems you are trying to compile a `.gpr` file.
This is not what you need. You can compile only `.adb` (sometimes
`.ads`). Instead of compiling `.gpr` file run "Build project"
Post by ldries46
\ada\project\Sudoku\Sudoku_main.gpr
ldries46
2024-12-04 09:18:17 UTC
Permalink
In the .gpr file in clearly stated that main:
"for Main use ("Sudoku_main.adb"); and "for Source_Dirs use ("./src",
...etc"
which means that according to the .gpr  file the compilation is for the
program that is presented in the .src directory. As I think the problem
is somewhere in the compilation,  Linker or Builder parts used in
the.gpr file
Post by Max Reznik
It seems you are trying to compile a `.gpr` file.
This is not what you need. You can compile only `.adb` (sometimes
`.ads`). Instead of compiling `.gpr` file run "Build project"
Post by ldries46
\ada\project\Sudoku\Sudoku_main.gpr
Max Reznik
2024-12-04 14:43:14 UTC
Permalink
I mean, I guess, you open the GPR file in the editor and launch "Compile
file" action in GNAT Studio. This makes no scene. This is the same as
open a text file and try to compile it, if you understand what I mean.

"Compile file" action in GNAT Studio works only for current open file,
the focused editor. It works only for Ada (or C/C++) source. GPR file is
not an Ada/C/C++ source, you can run "Compile file" on it.

What you can/should do is run "Build project".

I hope this helps.
ldries46
2024-12-05 08:21:13 UTC
Permalink
I think we do not understand each other. I an using the compiler 25.0 of
he community. In this compiler that includes an editor you are asked
which .gpr file you want to use. As a result all files that are
mentioned in the .gpr file can be reached by the editor as belonging to
the project. If you open another file it is not mentioned as a file
beloning to the project. The compiler just compiles only the files
belonging to the project. uses the .gpr file only as a guideline howe to
create an .exe file. In the program I have a BUILD command which has sub
commands (CHECK SYNTAX, CHECK SEMANTIC, COMPILE FILE, PROJECT, CLEAN,
RUN, SETTINGS) of which PROJECT is split into BUILD & RUN, BUID & DEBUG.
I have tried CHECK SYNTAX, CHECK CHECK SEMANTIC, which are all without
error, COMPILE, PROJECT/.. create errors   So what do exactly do wrong.
ldries46
2024-12-07 12:56:43 UTC
Permalink
Post by ldries46
I think we do not understand each other. I an using the compiler 25.0
of he community. In this compiler that includes an editor you are
asked which .gpr file you want to use. As a result all files that are
mentioned in the .gpr file can be reached by the editor as belonging
to the project. If you open another file it is not mentioned as a file
beloning to the project. The compiler just compiles only the files
belonging to the project. uses the .gpr file only as a guideline howe
to create an .exe file. In the program I have a BUILD command which
has sub commands (CHECK SYNTAX, CHECK SEMANTIC, COMPILE FILE, PROJECT,
CLEAN, RUN, SETTINGS) of which PROJECT is split into BUILD & RUN, BUID
& DEBUG. I have tried CHECK SYNTAX, CHECK CHECK SEMANTIC, which are
all without error, COMPILE, PROJECT/.. create errors So what do
exactly do wrong.
In mean time I found:
It looks like there is a complete compilation I have set a breakpoint at
line 44 of the main procedure of the program and with a part of the
listing of the BUILD & DEBUG  I see:

(gdb) whatis n_ini

type = integer

(gdb) ptype n_ini

type = <4-byte integer>

(gdb) print n_ini

$1 = 0

(gdb) print n_ini

$2 = 0

(gdb) break sudoku_main.adb:44

Breakpoint 1 at 0x4015a8: file
D:\ada\project\Sudoku\src\sudoku_main.adb, line 44.

(gdb) info breakpoints

Num Type Disp Enb Address What

1 breakpoint keep y 0x00000000004015a8 in sudoku_main at
D:\ada\project\Sudoku\src\sudoku_main.adb:44

(gdb) info breakpoints

Num Type Disp Enb Address What

1 breakpoint keep y 0x00000000004015a8 in sudoku_main at
D:\ada\project\Sudoku\src\sudoku_main.adb:44

(gdb) ptype &use

No definition of "use" in current context.

(gdb)

The part of the program is:

41   procedure Sudoku_main is
42   begin
43   n_ini := 2;
44   n_ini := Use_File("Sudoku");
45   Box_H := Get_Value(n_ini, "Grid", "H", 3);

etc...

The program stops before line 44.

Restarting the program to the next line result in

(gdb) where
No stack.
(gdb) x/32gx
0x000000000000000000000000000000000000000000000000000000000000000
0x0:    Cannot access memory at address 0x0
(gdb) x/256b
0x000000000000000000000000000000000000000000000000000000000000000
0x0:    Cannot access memory at address 0x0
(gdb) <^C>

So it looks like the program is still not starting

Loading...