5 years ago.

Error: Identifier "EventQueue" is undefined in "main.cpp", Line: 3, Col: 2

Hello I'm testing events based on mbed API tutorial and docs but have got error: Identifier "EventQueue" is undefined in "main.cpp", Line: 3, Col: 2

Can you adive me what is wrong?

include the mbed library with this snippet

#include "mbed.h"

EventQueue event ( 32 * EVENTS_EVENT_SIZE ) ;
Thread t ;

// LEDs
DigitalOut led_blue ( PB_6 );

// DigitalIn
DigitalIn user_button ( PB_2 );
InterruptIn user_button_int ( PB_2 );

// Toggle LED
void toggle_led ()
{
    led_blue = !led_blue;
}

int main() {
    t.start (  callback ( &event , &EventQueue::dispatch_forever )  ) ;
    // test led
    led_blue  = 1;
    // Toggle LEDs when button is pressed
    user_button_int.rise ( &toggle_led );

    while ( 1 )
    {
    }
}

The mbed library is added and updated.

best regards yabool2001

1 Answer

5 years ago.

Hi there, you probably use Mbed OS2 (does not include RTOS functionality) instead of Mbed OS5.

You can import MbedOS5 from https://github.com/ARMmbed/mbed-os into your program folder.

Best regards J.

Accepted Answer

Thanks a lot. So mbed official library imported from os.mbed.com (using import wizard in web compiler) is OS2 only.

best regards yabool2001

posted by Maciej Zemlo 23 Apr 2019