VSCode + GtkAda problem

Hi!
After a long break I started learning Ada again…
Under Windows 10 using Alire + VSCode I tried to compile a gtkada test program.
From the command line the usual “alr build” and “alr run” works, the test program builds and runs without errors.
Under VSCode the build is started with the following command:
alr exec -- gprbuild -P gtkada_test.gpr -cargs -gnatef

The “-gnatef” option seems to cause problems when compiling misc_generated.c:

Translated with DeepL.com (free version)
Compile
   [C]            misc_generated.c
cc1.exe: error: unrecognized debug output level 'natef'
gprbuild: *** compilation phase failed
ERROR: Command ["gprbuild", "-P", "gtkada_test.gpr", "-cargs", "-gnatef"] exited with code 4
ERROR: Command ["alr", "exec", "--", "gprbuild", "-P", "gtkada_test.gpr", "-cargs", "-gnatef"] exited with code 1

 *  The terminal process "C:\Program Files\PowerShell\7\pwsh.exe -Command alr exec -- alr exec -- gprbuild -P gtkada_test.gpr -cargs -gnatef" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it.

Unfortunately I don’t know how to make gcc not get the “-gnatef” option when compiling misc_generated.c.
Or maybe the problem is completely different?
I haven’t gone that deep into the depths of gprbuild yet… :slight_smile:
Thanks in advance for any help!

I think you want to use -cargs:ada -gnatef.
I do not use VSCode, so don’t know for sure where this should be done.

An alternative (which I would use) is to set this switch in package Builder of your gtkada_test.gpr project.

1 Like

You can hack JS file by editing %USERPROFILE%/.vscode/extensions/adacore.ada-24.0.3/out/src/extension.js.
Find "-cargs","-gnatef" and replace it by "-cargs:ada","-gnatef" as @ebriot said.
Or you can create your-own task with fixed command line options.
I will fix this in the development version. Thank you for reporting!

Thanks, but unfortunately it doesn’t work for me. Maybe it’s my fault, but either from command line or in VSCode the result is the same:

Alire PS:

PS C:\Users\ptihanyi\adawsp\gtkada_test> alr exec -- gprbuild -P gtkada_test.gpr -cargs:ada -gnatef
gprbuild: illegal option "-cargs:" on the command line
ERROR: Command ["gprbuild", "-P", "gtkada_test.gpr", "-cargs:", "ada", "-gnatef"] exited with code 4

VSCode:

 *  Executing task in folder c%3A%5CUsers%5Cptihanyi%5Cadawsp%5Cgtkada_test: alr exec -- alr exec -- gprbuild -P gtkada_test.gpr -cargs:ada -gnatef 

gprbuild: illegal option "-cargs:" on the command line
ERROR: Command ["gprbuild", "-P", "gtkada_test.gpr", "-cargs:", "ada", "-gnatef"] exited with code 4
ERROR: Command ["alr", "exec", "--", "gprbuild", "-P", "gtkada_test.gpr", "-cargs:", "ada", "-gnatef"] exited with code 1

 *  The terminal process "C:\Program Files\PowerShell\7\pwsh.exe -Command alr exec -- alr exec -- gprbuild -P gtkada_test.gpr -cargs:ada -gnatef" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it.

But on command line this works (note the quotation marks):
alr exec -- gprbuild -P gtkada_test.gpr "-cargs:ada" -gnatef

On VSCode, this trick not working :frowning:

powershell breaks -cargs:ada into two arguments :frowning: Add extra single quotes, like this: "'-cargs:ada'", "-gnatef".

Thanks a lot, it works now!