Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
SolveLLC
Level 7

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"
0 Kudos
8 Replies
SolveLLC
Level 7

Re: RAF SUB or FUNCTION defined twice.

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?
0 Kudos
Komag
Level 9

Re: RAF SUB or FUNCTION defined twice.

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.
0 Kudos
renojim
Level 8

Re: RAF SUB or FUNCTION defined twice.

Isn't 'Roku_Ads' the duplicate Sub/Function?
0 Kudos
TheEndless
Level 7

Re: RAF SUB or FUNCTION defined twice.

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.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
Roku Employee
Roku Employee

Re: RAF SUB or FUNCTION defined twice.

Every function and sub in the library is prefixed Roku_Ads_

- Joel
0 Kudos
Roku Employee
Roku Employee

Re: RAF SUB or FUNCTION defined twice.

"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.
0 Kudos
SolveLLC
Level 7

Re: RAF SUB or FUNCTION defined twice.

"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.
0 Kudos
EnTerr
Level 8

Re: RAF SUB or FUNCTION defined twice.

"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
0 Kudos