Recent

Author Topic: adding objcbase to uses list gives duplicate identifer  (Read 2686 times)

MISV

  • Hero Member
  • *****
  • Posts: 769
adding objcbase to uses list gives duplicate identifer
« on: December 23, 2021, 12:35:15 pm »
Hi,

Since I am giving up fixing fpc source and making Lazarus accept the new units files when compiling (works fine when browsing code) I am reimplementing all WKxxxx declarations myself.



OK, so having said that, adding WKFrameInfo to my own unit cause a problem...

Code: Pascal  [Select][+][-]
  1. Type
  2. WKFrameInfo =  objcclass external (NSObject, NSCopyingProtocol)
  3. public
  4.   function isMainFrame: ObjCBOOL: message 'isMainFrame';
  5.   function request: NSURLRequest: message 'request';
  6.   function copyWithZone (zone: NSZonePtr): id; message 'copywithzone:';
  7. end;
  8.  

gives error

Quote
"Error: Duplicate identifier "zone"

Quote
"Hint: Identifier already defined in unit OBJCBASE: objcbase,pp at line 134

OK... And so it is as a function in "NSObject = objcclass external (NSObjectProtocol)"... How do I fix this?

....


Kinda mystified I tried to include unit objcbase in my uses list and that gives error

Quote
"Error: Duplicate identifier "OBJCBASE"


(notice case)

I guess this is somehow added implicitly




Quick note: Anyone wanting to use the WKWebView browser for the utmost non-trivial things will need the WKxxxx declarations but will either need to fix source themselves or recompile and while checking generated files I have recompiled those I wanted it simply will not work in Lazarus: https://forum.lazarus.freepascal.org/index.php/topic,42001.msg428233.html#msg428233

« Last Edit: December 23, 2021, 12:45:24 pm by MISV »

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1978
  • Former Delphi 1-7, 10.2 user
Re: adding objcbase to uses list gives duplicate identifer
« Reply #1 on: December 23, 2021, 12:50:47 pm »
I believe in the past I've simply renamed a conflicting argument. The important part is the argument type. So try renaming zone to, say, myzone and cross your fingers and toes.
Lazarus 2.3, FPC 3.3.1 macOS 12.3.1 x86_64 Xcode 13.4
Lazarus 2.3, FPC 3.3.1 macOS 12.3.1 aarch64 Xcode 13.4

MISV

  • Hero Member
  • *****
  • Posts: 769
Re: adding objcbase to uses list gives duplicate identifer
« Reply #2 on: December 25, 2021, 02:35:41 pm »
Thank you. Appears to compile. I will write if I encounter further problems. Otherwise that is at least an alternative solution to the problem. (And if FPCSrc get fixed at some point each to remove declarations again)

 

TinyPortal © 2005-2018