Module public item is already declare in global scope

Just starting out? Need help? Post your questions and find answers here.
User avatar
MrTAToad
Posts: 291
Joined: Sun Apr 20, 2014 11:43 am
Location: Chichester, England
Contact:

Module public item is already declare in global scope

Post by MrTAToad »

For some reason when using UseModule to access one procedure in a module, this error message comes up, even though the offending procedure isn't defined globally.
Fred
Site Admin
Posts: 1506
Joined: Mon Feb 24, 2014 10:51 am

Re: Module public item is already declare in global scope

Post by Fred »

Could you post a small snippet showing the issue ?
User avatar
MrTAToad
Posts: 291
Joined: Sun Apr 20, 2014 11:43 am
Location: Chichester, England
Contact:

Re: Module public item is already declare in global scope

Post by MrTAToad »

I know what's going on now. It appears this error message comes up when a procedure with the same name occurs in more than 1 module :

Code: Select all

DeclareModule A
  Declare.i GetColourForAngle(a.f)
EndDeclareModule

DeclareModule B
  Declare.i GetColourForAngle(a.f)
EndDeclareModule

DeclareModule C
  Declare test()
EndDeclareModule

Module A
  Procedure.i GetColourForAngle(a.f)
  EndProcedure
EndModule

Module B
  Procedure.i GetColourForAngle(a.f)
  EndProcedure
EndModule

Module C
  UseModule A
  UseModule B
  
  Procedure test()
    GetColourForAngle(1)
  EndProcedure
EndModule
I didnt orginally find it as the module procedures were declared, but didn't exist...
Fred
Site Admin
Posts: 1506
Joined: Mon Feb 24, 2014 10:51 am

Re: Module public item is already declare in global scope

Post by Fred »

It's a legitimate error, as you can't use 2 module with the same function name
Post Reply