I'm getting an error when I'm trying to replace a GoTo in a while loop with a Continue, but whenever I do I get an error reading "Statement expected, but expression of type 'Boolean' found". Is continue a keyword not in Delphi 6? Does the error message mean something else?
Thanks.
It is in Delphi 5, so I would assume it is in Delphi 6.
There must be something else going on in your code, but without posting it, it's impossible to tell.
The error message means that somebody gave a variable the same name as the keyword and Delphi is using that instead of the keyword. Find the variable and try renaming it.
Related
When doing many different (obviously) wrong things in A++ syntax I only get "Syntax error" in Description and some number (Err:9999) in Diagnostic ID. This does not help me at all finding out whats wrong so I can fix it. No hint, no nothing!
This is compile time syntax errors that the IDE should just hand to me.
So how can I get more detailed information about what is wrong?
When you doubleclick on a syntax error line in the compiler output window, the code editor window opens and displays the code with the syntax error. The part of the code with the error is marked with a red squiggly underline and the cursor is placed at the start of the syntax error. This should make it easy to find out what is wrong.
In addition to what j.a.estevan suggested, in my experience syntax errors also occur because
you forget the second = symbol in the where part of a select statement
you unintentionally add a second = symbol when assigning the value of a variable
you delete a variable in the classDeclaration of a class/form, but it is still used in one of the methods
a macro is changed/deleted
an object is changed/deleted and the cross references were not up to date or not checked
There is no way of showing more information that this "Syntax error" for that error type. Almost always is a missing semicolon or brackets dispaired.
Compiling a rather large project (>750K lines) with delphi XE3 (upgrading from 2009)
Getting the following error
[dcc32 Fatal Error] MainForm.pas(3170): F2084 Internal Error: URW1147
Similar to this question, however nowhere in the code are generics used.
internal error with generic array
The error does not correspond to a line of code, but rather just the end of the file.
I.e. after the "end."
Following a google search I have also tried all settings for "Code inline control", but no joy.
Not sure where (else) to start looking and would appreciate any educated feedback (or maybe even a wild guess).
Have not yet put in a QC report pending hopefully usefully feedback from here.
Thanks
Have resolved this issue by stripping back the code a section at a time as per David's suggestion above.
Solution is was follows in case this is helpful to anyone...
Turns out there was a 'left over' fragment of 'generics' code which was thought to have been removed several years ago and replaced using more traditional techniques.
There was single local variable which was not refactored, defined as follows.
var
TestProc: TProc;
when assigned as per the following, the internal compiler error is triggered (however nowhere near the offending line of code).
TestProc := TestSuite.TestProcs[i].TestProc;
The array element TestProc above is of type procedure of object.
This compiles (and works perfectly) under 2009 which was why it wasn't picked up earlier, but gives an internal compiler error under XE3.
Correcting the local variable declaration (to procedure of object) fixes the problem.
I'm trying to connect my Windows XP program (Lazarus) to my Ubuntu postgres server.
When the Lazarus program runs, it seems to compile fine but I get this error:
Project ... raised exception class 'RunError(211)'.
Then it terminates execution (and I don't see any output), and opens up a file customform.inc. In that file, it shows a procedure procedure TCustomForm.DoCreate; where it highlights a line: if Assigned(FOnCreate) then FOnCreate(Self);
I believe this is one of the system's files.
I never get to see any output.
What could this be? Thanks!
MORE INFO:
I've narrowed down the error to this line:
dbQuery_Menu.SQL.Text:='Select * From "tblMenus"';
dbQuery_Menu.Open;
the exception is triggered when the OPEN statement gets executed.
BTW, dbQuery_Menu is defined as a TSQLQuery component.
Clueless! :(
Run error 211 appears when you try to call an abstract method. Check this link from more information on FreePascal/Lazarus runtime errors.
Since you say all is done by code and you have no visual components, the problem probably lies in your code trying to use an ancestor component which has not overriden the Open method. You should be able to solve this by using the correct descendant component.
Another possibility, although I would strongly recommend to avoid this one, is to override the Open method yourself. It should be avoided because if you are using an ancestor component then you probably would have to override more abstract methods.
HTH
After nearly 5 days I found the answer. Many thanks to all thos e ho have contributed with their ideas ESPECIALLY RRUZ, RBA and Guillem Vicens. there are other related posts all connected to getting the FIRST Lazarus program working with PostgreSQL.
Summary.
The biggest mistake I made here was that I used the TSQLConnection component. Don't do this. Instead use the TPQConnection.
Everything is done through code. We're not using any draggable components from the top tab.
Don't rely on the Lazarus docs (wiki) at least for working with PG DBs.. It is outdated. Some of the examples can be pretty misleading.
Make sure that fields have some default values. For example, if a Boolean field has no true or false (t/f) set, this may lead to errors.
And that's it! I hope many postgres+Lazarus newbies will find this useful.
From here - http://www.network-theory.co.uk/docs/postgresql9/vol2/SQLSTATEvsSQLCODE.html - -211 (ECPG_CONVERT_BOOL) This means the host variable is of type bool and the datum in the database is neither 't' nor 'f'. (SQLSTATE 42804)
I just splited a project in a few libraries.
And I have the strange error in the title.
I can't explain myself why it is the case.
Also, this error used to show up only in FSI.exe
I thought it was because of pb with loading dll in fsi but there is more to this.
It might be a stupid error (probably is..) but if anyone encoutered this sybillin error message before and knows what happens, I'd be glad to hear it.
UPDATE
I thought it was namespace issues, but it is not.
This issue is very odd. Please ignore it if you did not experienced it. I am still trying to pinpoint the exact origin.
Without more information it's hard to know for sure. One way this could happen is if you end up redefining a type in FSI without redefining some things that depend on it. Then those things expect the old version of the type, but you end up creating instances of the new version, which are not compatible. For instance, given this code:
type MyType<'a>() = class end
let myFun (_:MyType<int>) = 0
let result = myFun (MyType())
If I send the first two lines to FSI, then the first line again by itself, and then the third line, I get something similar to your error message. The solution is to re-evaluate all dependent definitions.
When using the following line code in Delphi 2010, a'm getting an "Access Violation" error, but the same code working fine in VC++.
The Delphi 2010 code is
var
hMyInf : HINF;
begin
hMyInf := SetupOpenInfFile('.\\DIGIMHID.INF','Mouse', INF_STYLE_WIN4,Nil);
The VC++ code is
hMyInf = SetupOpenInfFile(".\\DigimHID.inf", "Mouse", INF_STYLE_WIN4, NULL);
Please help me to solve this issue.
Thanks All.
Call LoadSetupAPI before using any methods in the SetupAPI.pas
Edit, to provide some background: As simultaneously wrote by David in his answer and by me in my comment, the error is probably caused by calling an uninitialized method pointer. For me the first tip was the error message, an Access Violation: If the equivalent of an Access Violation came from Windows itself, it'd be called a Runtime Error 216. The code is very simple, only uses constants and a method call. Constants can't generate AV's so the error had to come from the method itself, or from calling the method.
Since the Delphi declaration supplied showed a "function type", I suspected SetupOpenInfFile is actually an method pointer, not an import method. Those pointers need to somehow be initialized. Searching SetupAPI.pas (thanks google for providing a link, because I don't use JEDI libraries) I quickly found that it's being assigned from LoadSetupAPI. My first thought: isn't LoadSetupAPI called from the initialization section? It's not, so it needs to be called from code. Problem solved.
Your filename is wrong in the Delphi version. You don't escape \ in Delphi, a single one will do. But that wouldn't lead to an access violation.
My guess is that your GetProcAddress call is failing. But that is a guess. I'd like to see more code and the full error message.
EDIT
It seems that we were on the right track. Cosmin's answer will solve the problem for you. An alternative would be to switch to inplicit linking by removing the definition of the condition SETUPAPI_LINKONREQUEST in SetupApi.pas.