Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Working folders for a project

88 views
Skip to first unread message

Rick Duley

unread,
Sep 26, 2022, 10:50:43 PM9/26/22
to
It is my practice to load my software in the folder 'C:\' on my PC but to do my work in a separate disc partition 'D:\'.

I have created a new Project deploying it in D:\Ada Programming. I specified the Project Name and Main Name as My_SDC. My_SDC reads

project My_Sdc is
for Source_Dirs use ("Source Files");
for Object_Dir use "Object Files";
for Main use ("my_sdc.adb");
end My_Sdc;

Project --> Build All is successful and placed the relevant files where I expect them to be.

Project --> Build and Run --> My_SDC.adb results in this error message:

[2022-09-27 10:45:00] Error while trying to execute D:\Ada Programming\obj\my_sdc.exe: not an executable

Something is looking for a folder called D:\Ada Programming\obj which does not exist. How do I get it to look in the right place?

Nasser M. Abbasi

unread,
Sep 26, 2022, 11:24:49 PM9/26/22
to
I can't help you with the error but just one free advice

Never, ever use a space in files names or folder names.

Use "_" instead of space as a separator.

So "Ada Programming" folder name should be renamed to "Ada_Programming"

--Nasser

Emmanuel Briot

unread,
Sep 27, 2022, 2:14:09 AM9/27/22
to
> project My_Sdc is
> for Source_Dirs use ("Source Files");
> for Object_Dir use "Object Files";
> for Main use ("my_sdc.adb");
> end My_Sdc;

> Project --> Build and Run --> My_SDC.adb results in this error message:

Hello,
It has been years since I last used and develop GNAT Visual Studio, so I can't really help you. But a hint might be the
casing discrepency between the project file (my_sdbc.adb all lower cases) and the menu (My_SDC.adb). Maybe you
are not, in effect, loading that project file, but another one ? If I remember right, Studio will load a default project if
you do not load one explicitly, and it might well be using "obj" as the object directory, which is a frequent convention.

Emmanuel

Dmitry A. Kazakov

unread,
Sep 27, 2022, 2:27:36 AM9/27/22
to
The binary directories are

for Exec_Dir use ...;

and (for a library):

for Library_Dir use ...;

There is no need to specify any (Object_Dir included) unless you build
for different targets/scenarios, e.g. Debug/Release/Profile and need to
sort them out.

E.g.

for Object_Dir use
"obj" & Target_OS & "/" & Target_Arch & "/" & Development_Type;

As other said, keep you project interoperable between Windows and Linux:

1. Always use small letters
2. Newer use spaces
3. Newer use \ as a directory separator. (GCC and GNAT run-times
understand /).
4. Newer use Latin-1 or UTF-8 (not even in the string literals).

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

Rick Duley

unread,
Sep 27, 2022, 3:43:32 AM9/27/22
to
On Tuesday, September 27, 2022 at 2:27:36 PM UTC+8, Dmitry A. Kazakov wrote:

> 4. Newer use Latin-1 or UTF-8 (not even in the string literals).
>


I have no idea what text Studio is using,

G.B.

unread,
Sep 27, 2022, 3:59:32 AM9/27/22
to
On 27.09.22 08:27, Dmitry A. Kazakov wrote:
said, keep you project interoperable between Windows and Linux:
>
> 1. Always use small letters
> 2. Newer use spaces
> 3. Newer use \ as a directory separator. (GCC and GNAT run-times understand /).
> 4. Newer use Latin-1 or UTF-8 (not even in the string literals).

0. Never, ever, use full path literals. Or separator characters.
0.5. Fix GCC's silly dependence on path literals.





Dmitry A. Kazakov

unread,
Sep 27, 2022, 4:30:32 AM9/27/22
to
You have idea what letter you type. Do not type umlauts and you are good.

Simon Wright

unread,
Sep 27, 2022, 10:16:38 AM9/27/22
to
"Dmitry A. Kazakov" <mai...@dmitry-kazakov.de> writes:

> There is no need to specify any (Object_Dir included) unless you build
> for different targets/scenarios, e.g. Debug/Release/Profile and need
> to sort them out.

This is true, but I like to keep all the compiler-created stuff out of
sight.

Only one problem with that: that's where the executables get created! so
I'd say

for Object_Dir use ("obj");
for Exec_Dir use ("."); -- the same directory as the project file

NB Alire likes to use

for Exec_Dir use ("bin");

Stephen Leake

unread,
Sep 28, 2022, 4:35:20 PM9/28/22
to
Rick Duley <rick...@gmail.com> writes:

> It is my practice to load my software in the folder 'C:\' on my PC but
> to do my work in a separate disc partition 'D:\'.
>
> I have created a new Project deploying it in D:\Ada Programming. I
> specified the Project Name and Main Name as My_SDC. My_SDC reads
>
> project My_Sdc is
> for Source_Dirs use ("Source Files");
> for Object_Dir use "Object Files";

Note that this is different from the default "obj" for Object_Dir.

How did you edit this gpr file? if you did not use the GNAT Studio
Preferences editor, GNAT Studio does not know about this change from the
default.

>
> for Main use ("my_sdc.adb"); end My_Sdc;
>
> Project --> Build All is successful and placed the relevant files
> where I expect them to be.

I'm assuming you meaning the .exe is "D:\Ada Programming\Object
Files\my_sdc.exe", since that's what the gpr file says.

> Project --> Build and Run --> My_SDC.adb results in this error message:
>
> [2022-09-27 10:45:00] Error while trying to execute D:\Ada
> Programming\obj\my_sdc.exe: not an executable

This indicates GNAT Studio is not using the gpr file you want it to.

You can discover what GNAT Studio thinks the project file is by hovering
the mouse over the root folder in the Project window; for the Hello
World project I created, this shows
"/Projects/hello_world/hello_world.gpr" (I'm on Debian, hence the Unix
directory separators).

> Something is looking for a folder called D:\Ada Programming\obj which
> does not exist. How do I get it to look in the right place?

You need to specify your gpr file as the project file to open.

If you've edited the project file after you opened the project, you need
to tell GNAT Studio to read it again. I don't know how to do that short
of close the project and open it again.

--
-- Stephe

Björn Lundin

unread,
Sep 28, 2022, 5:23:00 PM9/28/22
to
On 2022-09-28 22:35, Stephen Leake wrote:

> If you've edited the project file after you opened the project, you need
> to tell GNAT Studio to read it again. I don't know how to do that short
> of close the project and open it again.
>

In the tabs to the left, the project tab has the reload symbol in top
left corner.
Two arrows forming a circle

--
/Björn

Simon Wright

unread,
Sep 29, 2022, 4:13:13 AM9/29/22
to
Stephen Leake <stephe...@stephe-leake.org> writes:

> How did you edit this gpr file? if you did not use the GNAT Studio
> Preferences editor, GNAT Studio does not know about this change from
> the default.

Studio has no memory between sessions aside from what's in the gpr file

Simon Wright

unread,
Sep 29, 2022, 4:57:34 AM9/29/22
to
Simon Wright <si...@pushface.org> writes:

> Studio has no memory between sessions aside from what's in the gpr
> file

I was very definite about that, but it's not quite true: GPS2019 (the
latest available edition for Mac) remembers scenario variables.

Also, ofc, preferences, previously-opened GPR files, ... I was only
thinking about project files.
0 new messages