I have a Lazarus project that I want to compile the source with gcc, for this I have TOpenDialog, called OpenDialog1and TProcess, called AProcess.
I call gcc using this code:
procedure TFormMain.btCompileClick(Sender: TObject);
begin
if OpenDialog1.Execute then
begin
AProcess := TProcess.Create(nil);
try
AProcess.CommandLine := 'gcc.exe ' + OpenDialog1.FileName;
AProcess.Options := AProcess.Options + [poWaitOnExit, poUsePipes];
AProcess.Execute;
OutputMemo.Lines.BeginUpdate;
OutputMemo.Lines.Clear;
OutputMemo.Lines.LoadFromStream(AProcess.Output);
OutputMemo.Lines.EndUpdate;
finally
AProcess.Free;
end;
end;
end;
It compiles fine (a Lazzarus project), but when I tested it, trying to compile the original test.c, which is in C:\Documents and Settings\Nathan Campos\Desktop, I got this on OutputMemo:
'C: \ Documents': no ββsuch file or directory
Then it OpenDialog1does not get the full path with spaces, or gcc cannot find it in the space folder.
Any suggestion to help me with this?
source
share