Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
SolveLLC
Visitor

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 8
SolveLLC
Visitor

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
Roku Guru

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
Community Streaming Expert

Re: RAF SUB or FUNCTION defined twice.

Isn't 'Roku_Ads' the duplicate Sub/Function?
Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
TheEndless
Channel Surfer

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
RokuJoel
Binge Watcher

Re: RAF SUB or FUNCTION defined twice.

Every function and sub in the library is prefixed Roku_Ads_

- Joel
0 Kudos
RokuKC
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
Visitor

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
Roku Guru

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