Compiler directive issue lazarus / 64-FPC development ---------------------------------------------------------------------- Pontiac · 2015-11-12 17:48 According to: http://lazarus- ccr.sourceforge.net/fpcdoc/prog/progsu29.html#x36-340001.1.29 and http://lazarus- ccr.sourceforge.net/fpcdoc/prog/progap7.html#x323-323000G I have the code: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i if Application.MessageBox(pchar(HDDFile+' is in a read only state.  Do you wish to enable read/write mode?'),'File Attribute',MB_YESNO+MB_ICONQUESTION)={$IFDEF FPC}IDYES{$ELSE}ID_YES{$ENDIF} then The problem I'm having is that the compiler thinks it should use ID_YES instead of IDYES. This particular unit is currently shared between Delphi 2010 and FPC, as will a few others will be until I completely migrate over to FPC, but I'm kinda curious to why this is happening? ---------------------------------------------------------------------- JuhaManninen · 2015-11-12 20:39 Neither of the pages mentions Application.MessageBox. Why did you add {$IFDEF FPC} there? ---------------------------------------------------------------------- Pontiac · 2015-11-12 21:24 Major edit: I'm not worried about application.messagebox, I'm wondering why the compiler is not honoring the {$IFDEF FPC}...{$ELSE}...{$ENDIF}. While compiling under FPC, it should compile with IDYES (FPC constant) and not ID_YES (Delphi constant).  The FPC compile error comes back saying it doesn't know what ID_YES is. ---------------------------------------------------------------------- rvk · 2015-11-12 21:30 The unit lcltype has this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   IDOK = 1;     ID_OK = IDOK;  IDCANCEL = 2; ID_CANCEL = IDCANCEL;  IDABORT = 3;  ID_ABORT = IDABORT;  IDRETRY = 4;  ID_RETRY = IDRETRY;  IDIGNORE = 5; ID_IGNORE = IDIGNORE;  IDYES = 6;    ID_YES = IDYES;  IDNO = 7;     ID_NO = IDNO;  IDCLOSE = 8;  ID_CLOSE = IDCLOSE;  IDHELP = 9;   ID_HELP = IDHELP; So can't you just use Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses Windows, {$IFDEF FPC} lcltype, {$ENDIF} ....etc I see you also have MB_YESNO & MB_ICONQUESTION in there and those are also not defined by default in Lazarus. So if you include lcltype it will also solve those constants. QuoteThis unit is being created specifically for compatibility with Delphi. It should only be used for constants and type definitions that are included in the Delphi Windows unit. This is only done for compatibiltiy. As for your problem. For me it does recognize IDYES so maybe you have {$UNDEF FPC} somewhere in your code Try that line in a clean empty project. ---------------------------------------------------------------------- Pontiac · 2015-11-12 21:50 I don't know what my computer was drinking this morning when I posted this, but now things are working as expected after I left it alone for several hours. Copy/paste of earlier from my thread; Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i if Application.MessageBox(pchar(HDDFile+' is in a read only state.  Do you wish to enable read/write mode?'),'File Attribute',MB_YESNO+MB_ICONQUESTION)={$IFDEF FPC}IDYES{$ELSE}ID_YES{$ENDIF} then What I have now: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i if Application.MessageBox(pchar(HDDFile+' is in a read only state.  Do you wish to enable read/write mode?'),'File Attribute',MB_YESNO+MB_ICONQUESTION)={$IFDEF FPC}IDYES{$ELSE}ID_YES{$ENDIF} then Now it works fine. The only thing I did was try and add the lcltype file, recompile to verify the suggestion by rvk, it worked.  I reverted the lcltype change, recompiled, and it worked. ... Computers these days. EDITWAR: @rvk - I've not used any UNDEFs ever anywhere.  I've only been actively using Laz/FPC for a couple of days, and this is the first unit I've had to convert so far. ---------------------------------------------------------------------- rvk · 2015-11-12 21:53 Quote from: Pontiac on November 12, 2015, 10:50:04 pmI reverted the lcltype change, recompiled, and it worked. I would still use the lcltype-method. It will save you a lot of {$IFDEF FPC}s in your code and all those IFDEFs only make your code more difficult to read. You can remove all those {$IFDEF FPC} from your code after using lcltype. ---------------------------------------------------------------------- Pontiac · 2015-11-14 22:03 I came across something rather interesting with this issue. Still, without using LCLType unit, I was running into this problem when I launched Lazarus from the shortcut on my desktop.  I went to File> Open Recent> NameOfThisProject.lci. I first noticed that the unit which my original line came from was in considered read only as far as Laz was concerned.  I checked the file permissions and no, it is not read only.  So then thought that maybe Laz was loading the wrong unit (Since it is in multiple locations) so deleted the others and just kept this one.  Using this method, the unit is not found (Yet exists in the directory).  So somehow it was loading up a version of this unit from somewhere else.  Ok!  Step in the right direction, but still doesn't answer the IFDEF FPC problem. I closed down Laz, this time launched Laz via the .LCI file and voila the unit shows up as I last had it, and it is R/W.  Looking down at this unit, I see that NOW it thinks FPC is defined. So when using the FILE> OPEN RECENT, is the directory not changed?  Am I loading up from some kind of directory (Probably my "Global Units/SQLite" directory), which THAT one was R/O.  Why when I launch IDE from the desktop, it doesn't think that FPC is defined? I'm sorry about ignoring the suggestion of using the LCLType unit, but I need to know how this IDE works to use it effectively.  I'm not one of those developers that like to adhoc stuff like this when my usual routine is breaking down.  I have a very impulsive need to understand what is going on with this.  If I write applications ground up to absolutely remove Delphi from existing and new projects, I have to know where the IDE is getting its stuff, and I'm not seeing where yet, both for files AND for the compiler directives. Edit: First thing I realized I was doing wrong.  I shouldn't be opening the LPI but the LPR.  Ok, cool.  However, when I load the LPR from the directory (Not desktop) the IDE again thinks that LAZ is not defined. This project was started ENTIRELY within Lazarus, not Delphi.  The only thing that is Delphi related is the SQLite related units I've been using for a few years and don't quite want to let go of. Time to pull out some text editors. ---------------------------------------------------------------------- rvk · 2015-11-14 22:20 You're quite right in wanting to know why {$IFDEF FPC} doesn't work for you. Using lcltype is for later. You mention a .lci file... did you mean .lpi. (I don't know what .lci stands for) But you also say you do it via File > Open Recent > project.??? I think that's not the correct way to open a project. You should be using Project > Open Recent Project It could be that your file was just opened as a unit in another project. You can check with what project you're working in the Project > Project inspector So maybe the unit you opened with File > Open Recent isn't used at all at that moment. So if you open your project via Open Recent Project, is your unit R/W at that moment, like it should be? ---------------------------------------------------------------------- bkercso · 2016-02-12 10:15 Hi, I'm new in this topic. Maybe you can help me: I have a problem with using FindNext (AfterFindFirst). When I write: repeat ... until FindNext(Info)<>0; I get the error message: "Syntax error: "." expected but "(" found" Here is a pictuare about that. It accepts only when I using FindNext.BooleanVariable, but this is not a function anymore! http://i68.tinypic.com/k0n7sz.png ---------------------------------------------------------------------- rvk · 2016-02-12 10:20 Quote from: bkercso on February 12, 2016, 11:15:32 amI get the error message: "Syntax error: "." expected but "(" found" I'm not sure what this has to do with this topic. You could have opened a separate topic in the beginners sections. But as for your problem. You have a program named FindNext. In that case the FindNext-FUNCTION doesn't work anymore because that's the name of your program. If you name your program FindNextProgram your error-message goes away. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program FindNextProgram;  You even called your program FindNext2.pas pas so you also do Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program FindNext2; (as long as you don't call it FindNext) ---------------------------------------------------------------------- bkercso · 2016-02-12 11:21 Many many THX! This working now!!