RES_ID not valid, AUResources.r rez issue

This has come up for me a few times. I forget how I got around it before, but whatever the case I thought I would mention it and see if anyone knows whats going on …

  • just did a fresh clone of the repo
  • loaded the plugin example, compiled, no issues.
  • loaded my own plugin code, copied the wrapper code from the plugin, compiled … got this:

    /Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUResources.r:68:0 Undefined variable (RES_ID) not allowed in expression.

I’ve gotten that one before … couldn’t remember the fix so I wrangled with my code for a bit and just couldn’t get it.

Went back to the jucePlugin example code, right clicked on AUResources.r and tried to compile … got the SAME ISSUE!!! How is that possible? It compiled fine a second ago? Read some forums and saw that this occurs of you include the file twice somehow … hmmm.

So I removed the file from the source tree in the plugin example code … recompiled … all good.

Did the same with my code … all good.

Not sure how / if AUResources.r is getting included twice, or why it compiled fine, then couldn’t compile AUResources.r when asked.

Should mention that it seems to work fine after the compilation (with AUResources.r removed that is), which also seems weird unless it actually is included in two places.

Never seen that one before… And not sure how it could get included twice, it’s definitely only there once in the project (?)

Yeah I know, it’s stumped me all day so far.

I’m suspicious of the “it get’s included twice and thats why the error”. It doesn’t seem right … but, I can’t figure out what else could be the issue.

Also stumped as to how the plugin manages to compile/run fine without having that file included. I just did a fresh clean/rebuild and it’s definitely ok without having AUResourses.r included anywhere.

… my head hurts.

well … after 3 hours of banging my head against a wall, I just started from the working example plugin, stripped out what I didnt need and brough my code in (getting really good at this nowadays). Everything works fine of course.

I spent another hour comparing the one that gives me errors and the one that doesn’t. They use exactly the same files, and I havent found any xcode config differences … nonetheless … one gives me the above errors when AUResources.r is included … go figure.

Could have just been an XCode intermediate files that got messed up - sometimes I find it’s a good idea to delete everything in the XCode cache folder as well as doing a clean rebuild.