Forum Discussion

SolveLLC's avatar
SolveLLC
Visitor
10 years ago

RAF SUB or FUNCTION defined twice.

I'm not sure what I'm doing wrong here.

ERROR compiling /pkg:/source/VAST_VideoScreen.brs:
SUB or FUNCTION defined twice. (compile error &had) in roku_ads_lib:/Roku_Ads.brs(30) 'Roku_Ads'
SUB or FUNCTION defined twice. (compile error &had) in pkg:/source/VAST_VideoScreen.brs(1)

Line 1 of VAST_VideoScreen.brs is
Library "Roku_Ads.brs"

8 Replies

  • So obviously I have a Sub or Function somewhere that has the same name as a Sub or Function in Roku_Ads.brs. Is there a reserved naming convention for Subs/Fuctions documented somewhere?
  • Are those line numbers? 30 and 1? You don't have a Roku_Ads.brs file because that is a Roku library buried somewhere?

    Hmm, dunno. How many functions do you have, and how hard would it be to just change a bunch of them?
    You could just change half of them (even though it breaks your program) to see if it will compile, then narrow it down with half again, etc.
  • renojim's avatar
    renojim
    Community Streaming Expert
    Isn't 'Roku_Ads' the duplicate Sub/Function?
  • Why are you using RAF and the old VAST_VideoScreen.brs in the same channel? Assuming you're implementing RAF, I'd expect you'd be removing the older VAST source files.
  • Every function and sub in the library is prefixed Roku_Ads_

    - Joel
  • RokuKC's avatar
    RokuKC
    Roku Employee
    "SolveLLC" wrote:
    I'm not sure what I'm doing wrong here.

    ERROR compiling /pkg:/source/VAST_VideoScreen.brs:
    SUB or FUNCTION defined twice. (compile error &had) in roku_ads_lib:/Roku_Ads.brs(30) 'Roku_Ads'
    SUB or FUNCTION defined twice. (compile error &had) in pkg:/source/VAST_VideoScreen.brs(1)

    Line 1 of VAST_VideoScreen.brs is
    Library "Roku_Ads.brs"


    You can only have:
    Library "Roku_Ads.brs"

    once in all your sources.
    If you have it more than once, you will get the duplicate functions error.
  • "TheEndless" wrote:
    Why are you using RAF and the old VAST_VideoScreen.brs in the same channel? Assuming you're implementing RAF, I'd expect you'd be removing the older VAST source files.


    Its *supposed* to be a minor change......the pre and mid roll logic is buried in this file.
  • "RokuKC" wrote:
    You can only have:
    Library "Roku_Ads.brs"
    once in all your sources.
    If you have it more than once, you will get the duplicate functions error.

    A drive-by suggestion^: make Library load a file only once, i.e. akin to C's #import and not #include. It makes no sense to be otherwise, given the flat namespace of B/S and is as simple to implement as check string membership in a set (lookup dictionary).

    (^) Suggestions! Big sale! Dime a dozen! Get your suggestions here! Smiley LOL