'rp2040' not declared in this scope

So I'm not sure whether this is in the right category, but I suppose it is to do with troubleshooting as I'm 99% certain it has nothing to do with the code for reasons I'll get into.

I'm using a raspberry pi pico.

I'm getting the compilation error 'rp2040' was not declared in this scope while using the raspberry pi pico to run multiple cores. I'm pretty new to this particular aspect of programming but the code is an example given to us by our lecturer so it should work fine.

I've asked classmates and they've all said they had no issues running the example code, nor did they have any issues implementing multicore processing so it must have something to do with missing libraries. I've reinstalled the IDE and recently upgraded to 2.0.1 with no success.

// traffic_lights_5
#include "sub.h"

// global variables
uint8_t  state=0, oldstate;
uint32_t watch = millis();

#include "second.h"

void loop() {
  // put your main code here, to run repeatedly:

  switch (state)  {
    case 0:
      r(); 
      if ((millis()-watch) > 1000 ) {
        watch = millis(); state = 1;
      }
      break;
    case 1:
      ry(); 
      if ((millis()-watch) > 1000 ) {
        watch = millis(); state = 2;
      }
      break;
    case 2:
      g(); 
      if ((millis()-watch) > 1000 ) {
        watch = millis(); state = 3;
      }
      break; 
    case 3:
      y(); 
      if ((millis()-watch) > 1000 ) {
        watch = millis(); state = 0;
      }
      break;
    case 4:
      r(); 
      if ((millis()-watch) > 3000 ) {
        watch = millis(); state = oldstate;
      }
      break;                        
  }

  if ( rp2040.fifo.available() )  {
    uint32_t dummy;  // received values
    while ( rp2040.fifo.available() ) // clear fifo
        rp2040.fifo.pop_nb(&dummy);
    oldstate = state;
    state = 4;
  }
   
}

Inside second.h subroutine...

void loop1() {
  
  if ( !digitalRead(20) )  {
    rp2040.fifo.push_nb(1);
    delay(10000);
  }

}

And inside the sub.h subroutine

#define R_led 8
#define Y_led 7
#define G_led 6

void setup() {
  // put your setup code here, to run once:
  pinMode(R_led,OUTPUT);
  pinMode(Y_led,OUTPUT);
  pinMode(G_led,OUTPUT);
  //attachInterrupt(digitalPinToInterrupt(20),isr20,FALLING);
}

void r(void)  { // after y
  analogWrite(G_led,0);
  analogWrite(Y_led,0);  
  analogWrite(R_led,5); 
}

void ry(void) { // after r
  analogWrite(G_led,0);
  analogWrite(Y_led,20);  
  analogWrite(R_led,5); 
}

void g(void)  { // after ry
  analogWrite(G_led,255);
  analogWrite(Y_led,0);  
  analogWrite(R_led,0);
}

void y(void)  { // after g
  analogWrite(G_led,0);
  analogWrite(Y_led,20);
  analogWrite(R_led,0); 
}

Completely at a loss at this point. Any help would be greatly appreciated.

Please post ALL your code.

Do you have the correct libraries installed?

Apologies, I've updated the original post.

If I don't I have no idea which ones need installing. No classmates mentioned having to install any extra libraries when I asked them, the example code seemed to just work for them.

I've installed the Arduino Mbed OS RP2040 board support and selected raspberry pi pico, which as far as I knew was the only thing I needed.

Have you got the correct board selected in the Board Manager?

No I don't think I do. Where can I get that particular one? I get these options and nothing else comes up in boards manager. I'll feel like an idiot if I'd had the wrong board support selected this entire time...

In the Arduino IDE Preferences, add the following to the list of additional boards.

https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json

Restart the Arduino IDE.

Then go into Tools > Board Manager

Search for "Pico" and install the following.

You should then see the available boards to select in the IDE.

Oh my god, thank you so much. I've actually been plodding along using the wrong board file for two months wondering why I've been getting loads of weird communication issues!

Just for future reference, if I were to need something like this for a different board how would I go about finding it? Are there any obvious search terms to put into google or will I need to go to some section of github?

Thanks so much again for your help, must have missed the part of the lecture where he got us to install that library!

This is what I used...

https://www.google.com/search?q=pi+pico+arduino

First hit...

:smiling_face_with_tear:

Words can't describe how embarrassed I am that I didn't manage to find that. Spent so long searching the error message that I didn't really think about anything else, sorry for wasting your time on something so trivial.

Thanks again!