Choking on commented code?!? lazarus / 9-Editor ---------------------------------------------------------------------- masonwheeler · 2008-01-08 19:06 There was something in my project that the compiler didn't like, so I commented it out and wrote a workaround.  And yet, for some reason, the compiler's still checking it and reporting an error.  Is this some programmer's idea of a joke?  How do I get it to ignore commented-out code? ---------------------------------------------------------------------- Phil · 2008-01-08 19:24 Quote from: "masonwheeler"There was something in my project that the compiler didn't like, so I commented it out and wrote a workaround.  And yet, for some reason, the compiler's still checking it and reporting an error.  Is this some programmer's idea of a joke?  How do I get it to ignore commented-out code? Please post an example that illustrates this behavior. Thanks. -Phil ---------------------------------------------------------------------- masonwheeler · 2008-01-08 19:44 for i := 1 to length(data.myArray) do       begin          item := myListbox.items.add; //workaround          item.caption := data.names;          item.data := TObject.create; {         myListbox.AddItem(data.names, tObject.Create);}       end; Compiler chokes on this: Error: identifier idents no member "AddItem" myListbox is a TListView component. ---------------------------------------------------------------------- Marc · 2008-01-09 10:42 This should work. the line *is* commented and the given exampe should compile fine. ---------------------------------------------------------------------- Phil · 2008-01-11 02:43 Quote from: "masonwheeler"for i := 1 to length(data.myArray) do       begin          item := myListbox.items.add; //workaround          item.caption := data.names;          item.data := TObject.create; {         myListbox.AddItem(data.names, tObject.Create);}       end; Compiler chokes on this: Error: identifier idents no member "AddItem" myListbox is a TListView component. Would it be possible for you to work up example code that we could try compiling? We can't compile this code since it refers to other things declared elsewhere. Thanks. -Phil ---------------------------------------------------------------------- masonwheeler · 2008-01-11 19:52 I've observed this behavior in a few other places now.  It seems to always be the same thing.  Something that worked in Delphi doesn't work in Lazarus.  I comment it out and rewrite it.  The compiler chokes on the commented code.  I wonder if it isn't being kept in some sort of partially-compiled unit (what's the Lazarus/FPC version of a DCU?) that isn't being cleared out properly?  I'll write up some example code and see if I can make this reproducible on demand.  If so, I'll post a link here. ---------------------------------------------------------------------- felipemdc · 2008-01-11 22:24 It's surely that it's using old .o / .ppu files instead of rebuilding. Remove all .o / .ppu files and try again. The "Build All" command should also do it afaik, but may want to create a script that clears all your .o / .ppu files to quickly clean your project directories when needed. ---------------------------------------------------------------------- mikaelo · 2008-03-20 19:44 I have seen and having to deal with comment errors quite a bit. Particularly code with a large comment block headers and always when using then {} comment. It complains of error inside the comment, but when changing the block comment to (*  *) instead, it all works fine. And this is comment that, to that point have worked just fine. using line comments (//) has never seemed to cause any issues either, just {} comments. This and when the IDE decides to no longer finding modules and flagging error while doing command completion (Shift+Crtl + space), event though the project still compiles just fine, are to me are some of the most aggrevating issues when working on large projects. Since this to a point is what I would consider very minor issues, I usually just chose to ignore them, but when I almost automatically press the command completion keys, just to have the IDE jump you to a different unit flagging  a unit not found, even though it worked just fine earlier, can get a bit aggrevating. Otherwise it's a wonderfull product. Mikael ---------------------------------------------------------------------- Marc · 2008-03-21 10:19 Unlike Delphi, FPC (in FPCmode) knows about nested comments. So comments likeCode: [Select] (* some comments   { some other } *) are possible. However when you skip the } it complains about an open comment. in delphi mode the compiler is compatible with delphi on this. However, the ide cant parse on compiler mode, so it assumes fpcmode. ---------------------------------------------------------------------- windy · 2008-03-23 01:13 yes, i have found you need to be carefull with brackets inside brackets i.e check further up your code , maybe you do not have the same number of closing as opening brackets