Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
6 years, 6 months 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
6 years, 6 months 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.