Manlio Laschena 0 Posted June 2, 2023 (edited) I am experiencing the error on object, but only in debug mode 32B. If I switch to realease the code compiles and run without problem. Can you give me a hint where to look for mistake ? Edited June 2, 2023 by Manlio Laschena typing error Share this post Link to post
programmerdelphi2k 237 Posted June 2, 2023 @Manlio Laschena maybe a "developer" error? who knows? please, post your code in question Share this post Link to post
Manlio Laschena 0 Posted June 2, 2023 It's just few lines, beginning a simple app. Unable to find any trivial item. ----------------------------- unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls,ABSMain,DB,DBCtrls; type TForm1 = class(TForm) Button1: TButton; Edit1: TEdit; Edit2: TEdit; Edit3: TEdit; ABSDatabase1: TABSDatabase; ABSTable1: TABSTable; procedure Button1Click(Sender: TObject); procedure FormCreate(Sender: TObject); private { Private declarations } function Validatevoci(const voci:array of string):Boolean; public { Public declarations } end; var Form1:TForm1; voci: array[0..2]of string; // = ('First name','Last name','email'); implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); Begin if inputquery('Pls enter data',['First name', 'Last name', 'Email' ],voci, validatevoci) then begin edit1.Text:= voci[0]; edit2.Text:= voci[1]; edit3.Text:= voci[2]; end; end; function TForm1.Validatevoci(const voci:array of string):Boolean; var g:string; begin g:=Application.Title; Application.Title:=' Errore '; //per modificare il titolo del displaybox Result := (voci[0]+voci[1]+voci[3])<>''; if not result then begin showmessage('You must enter full Name and Email data'); Application.Title:=g; // Button1.click; end end; procedure TForm1.FormCreate(Sender: TObject); begin ABSDatabase1.DatabaseFileName:=ExtractFilePath(Application.ExeName)+'Customers.abs'; ABSDatabase1.Open; ABSTable1.TableName:='Cust01'; ABSTable1.Open; Edit1.text:=''; Edit2.text:=''; Edit3.text:=''; end; end. Share this post Link to post
Angus Robertson 574 Posted June 2, 2023 voci[3] will cause an exception since its length is only 3, base 0. No idea what this has to do with ICS. Angus Share this post Link to post
Manlio Laschena 0 Posted June 2, 2023 voci[3] was due to my error to code when I am almost sleeping ! At the moment I can only code under release mode, but I must find a solution. A solution could be to turn the entry phase into a dll and start from scratch the real application hoping withou the invalid compiler directive. I am confused. Never seen an exception only on debug mode. Thanks for your time Manlio Share this post Link to post
Angus Robertson 574 Posted June 2, 2023 That error should be found by runtime range checking, probably enabled for release but not debugging. Angus Share this post Link to post
Pat Foley 51 Posted June 2, 2023 2 hours ago, Manlio Laschena said: g:=Application.Title; Application.Title:=' Errore '; //per modificare il titolo del displaybox Use form.caption here. You can use Application.Title in .dpr. Share this post Link to post
programmerdelphi2k 237 Posted June 2, 2023 (edited) @Manlio Laschena you can try some like this: implementation {$R *.dfm} var LArrPrompts: TArray<string>; // 3 elements LArrValues : TArray<string>; // 3 elements LAnswers : TArray<string>; // 3 elements function VerifyMyInputs(const AValues: array of string): Boolean; begin LAnswers := []; // // your rules... for var i: integer := 0 to high(AValues) do if AValues[i].IsEmpty then LAnswers := LAnswers + [LArrPrompts[i] + ' is empty']; // result := length(LAnswers) = 0; // if "0" all it's right! NOTE: im forcing "0" = true! but you can do it any other way! // if not result then // just for test on screen.. .do it as you want! Form1.Memo1.Lines.AddStrings(LAnswers); end; procedure TForm1.Button1Click(Sender: TObject); begin LArrPrompts := ['First Name', 'Last Name', 'Email']; LArrValues := ['', '', '']; // equals to LArrPrompts size! // Memo1.Lines.Clear; // if InputQuery('Caption', LArrPrompts, LArrValues, VerifyMyInputs) then Memo1.Lines.Add('ok'); end; Edited June 2, 2023 by programmerdelphi2k Share this post Link to post
Remy Lebeau 1396 Posted June 3, 2023 8 hours ago, Manlio Laschena said: At the moment I can only code under release mode, but I must find a solution. A solution could be to turn the entry phase into a dll and start from scratch the real application hoping withou the invalid compiler directive. I am confused. Never seen an exception only on debug mode. You still haven't shown the actual 'invalid compiler directive' error, or what code the error is referring to. That error is a compile-time error. But you said your code compiles and runs, it was just experiencing a runtime error instead, due to accessing an array out of bounds. So, what is the REAL problem here? Share this post Link to post
Manlio Laschena 0 Posted June 3, 2023 the problem is that I cannot run on debug mode. I said the code compiles only on release mode. I am just at the first lines of coding now. In the progress I will need to run on debug mode: no developer is perfect !! Share this post Link to post
David Heffernan 2345 Posted June 3, 2023 If there's an error reported by the compiler, is possible for you to copy and paste that here? Is it possible that we can say the minimal code that reproduces the issue? At the moment you are asking us to give you directions but blind folding us. Share this post Link to post
Manlio Laschena 0 Posted June 3, 2023 Hi David, do you really think I am so stupid to voluntarily blid people could help me ? It's enough to ask ! ---------------- [dcc32 Fatal Error] F1030 Invalid compiler directive: '-AC:\Users\manli\Documents\Lavori\Projects\2023\Test\InputQuery\;Generics.Collections=System.Generics.Collections;Generics.Defaults=System.Generics.Defaults;WinTypes=Winapi.Windows;WinProcs=Winapi.Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE' --------------------------------- BTW I ported the app to another machine (windows 10) with Delphi XE5 and resulted no invalid compiler directive on debug mode. Share this post Link to post
David Heffernan 2345 Posted June 3, 2023 1 hour ago, Manlio Laschena said: Hi David, do you really think I am so stupid to voluntarily blid people could help me ? It's enough to ask ! ---------------- [dcc32 Fatal Error] F1030 Invalid compiler directive: '-AC:\Users\manli\Documents\Lavori\Projects\2023\Test\InputQuery\;Generics.Collections=System.Generics.Collections;Generics.Defaults=System.Generics.Defaults;WinTypes=Winapi.Windows;WinProcs=Winapi.Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE' --------------------------------- BTW I ported the app to another machine (windows 10) with Delphi XE5 and resulted no invalid compiler directive on debug mode. And what about the rest of what I asked for? Share this post Link to post
Manlio Laschena 0 Posted June 3, 2023 Hi David, At the beginning of that "story" I was requested to copy the code and I did (roll back). Then you are asking the error message and I did. There is no other info I "blind". Don't understand what you are asking for . Share this post Link to post
David Heffernan 2345 Posted June 3, 2023 We can't reproduce what you report. Looks like the issue might be in your project settings. Maybe. Share this post Link to post
Manlio Laschena 0 Posted June 3, 2023 Hi David, I completely agree with you. It's more then two hours I am debugging my project settings, with no result, If you rewind my comments I have ported the code to a Delphi XE5 on another machine and I had no problems at all. Unfortunately I cannot work on that computer and I have to come back to a windows 11 with Sydney. It was just the starting of an app and now I decide to write again the few lines of code from the scratch on a new project. I don't like it, as I remain with an unsolved bug. But as I know myself, having time, I will return to investigate. For my experience these type of problems generally are very very very simple to Hide them behid silly things. Thanks for your time Manlio Share this post Link to post
Uwe Raabe 2057 Posted June 3, 2023 (edited) 3 hours ago, Manlio Laschena said: [dcc32 Fatal Error] F1030 Invalid compiler directive: '-AC:\Users\manli\Documents\Lavori\Projects\2023\Test\InputQuery\;Generics.Collections=System.Generics.Collections;Generics.Defaults=System.Generics.Defaults;WinTypes=Winapi.Windows;WinProcs=Winapi.Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE' This looks like a bad Unit Alias entry in the Debug configuration. Open the Project options and select Delphi Compiler. Check the Unit Alias entries for the different build configurations. You may spot the path name somewhere, which may be entered there instead of into the Search Path entry. Edited June 3, 2023 by Uwe Raabe Share this post Link to post
Manlio Laschena 0 Posted June 3, 2023 You hit exactly the target. Thanks a lot. I wasted so much time. Neverthless the alias pointed to the working folder, therefore I don't understand exactly why resulted in a invalid directive. Would be interested to know your opinion. Generally the alias refer to a compatibility version. Share this post Link to post
Uwe Raabe 2057 Posted June 3, 2023 A Unit Alias consists of a name-value pair like WinTypes=Winapi.Windows. It is used to map old unit names to the newer ones. A single folder name doesn't match that requirement. Share this post Link to post
programmerdelphi2k 237 Posted June 3, 2023 (edited) @Manlio Laschena another tip (normally always works) when porting old projects to new IDE, is always good create a new project (DPR at least), then just "ADD" all units/files into it. That way you are certains that all setup would be ok. now, just update any particular setup and save you new Project in a folder to new IDE. Then, you'll have each project to each IDE using same unit files, etc... and, as expected, you'll be able to use "compiler directives" internally in units to ensure that a certain encoding is targeted for each compiler version, for example! little steps, saving many heartbeats! old projects (DPRs/DPROJs) untouched! Edited June 3, 2023 by programmerdelphi2k Share this post Link to post
David Heffernan 2345 Posted June 3, 2023 1 hour ago, programmerdelphi2k said: when porting old projects to new IDE, is always good create a new project (DPR at least), then just "ADD" all units/files into it. That way you are certains that all setup would be ok. Except this is troublesome if you have important project settings defined in the dproj file Share this post Link to post
programmerdelphi2k 237 Posted June 3, 2023 2 hours ago, programmerdelphi2k said: now, just update any particular setup and save you new Project in a folder to new IDE. Then, you'll have each project to each IDE Share this post Link to post