4 years, 4 months ago.

cmake mbed-gcc error

Hello

I'm getting an error trying to compile after exporting to cmake. I am able to build fine exporting directly to a makefile and also doing a direct mbed compile. It only occurs when first exporting to cmake and using the cmakelist.txt to generate a unix makefile. The error is below. The USBCDC_EMC.h file mentioned does have an include to EventQueue.h and the path to EventQueue.h is listed in the INCLUDE_DIRECTORIES in the cmakelist.txt so I'm a tad confused on why I'm getting this. Any suggestions would be greatly appreciated.

In file included from /home/Code/mbed-test/mbed-os/drivers/source/usb/USBCDC_ECM.cpp:19:0: /home/Code/mbed-test/mbed-os/drivers/USBCDC_ECM.h:261:5: error: 'events' does not name a type events::EventQueue _queue; ^~~~~ [ 5%] Building CXX object CMakeFiles/mbed-test.dir/mbed-os/drivers/source/usb/USBKeyboard.cpp.obj /home/Code/mbed-test/mbed-os/drivers/source/usb/USBCDC_ECM.cpp: In constructor 'USBCDC_ECM::USBCDC_ECM(bool, uint16_t, uint16_t, uint16_t)': /home/Code/mbed-test/mbed-os/drivers/source/usb/USBCDC_ECM.cpp:46:92: error: class 'USBCDC_ECM' does not have any field named '_queue' : USBDevice(get_usb_phy(), vendor_id, product_id, product_release), _packet_filter(0), _queue(4 * EVENTS_EVENT_SIZE) ^~~~~ /home/Code/mbed-test/mbed-os/drivers/source/usb/USBCDC_ECM.cpp:46:103: error: 'EVENTS_EVENT_SIZE' was not declared in this scope : USBDevice(get_usb_phy(), vendor_id, product_id, product_release), _packet_filter(0), _queue(4 * EVENTS_EVENT_SIZE) ^~~~~~~~~~~~~~~~ /home/Code/mbed-test/mbed-os/drivers/source/usb/USBCDC_ECM.cpp: In constructor 'USBCDC_ECM::USBCDC_ECM(USBPhy*, uint16_t, uint16_t, uint16_t)': /home/Code/mbed-test/mbed-os/drivers/source/usb/USBCDC_ECM.cpp:60:82: error: class 'USBCDC_ECM' does not have any field named '_queue' : USBDevice(phy, vendor_id, product_id, product_release), _packet_filter(0), _queue(4 * EVENTS_EVENT_SIZE) ^~~~~ /home/Code/mbed-test/mbed-os/drivers/source/usb/USBCDC_ECM.cpp:60:93: error: 'EVENTS_EVENT_SIZE' was not declared in this scope : USBDevice(phy, vendor_id, product_id, product_release), _packet_filter(0), _queue(4 * EVENTS_EVENT_SIZE) ^~~~~~~~~~~~~~~~ /home/Code/mbed-test/mbed-os/drivers/source/usb/USBCDC_ECM.cpp: In member function 'void USBCDC_ECM::_init()': /home/Code/mbed-test/mbed-os/drivers/source/usb/USBCDC_ECM.cpp:81:29: error: '_queue' was not declared in this scope _thread.start(callback(&_queue, &events::EventQueue::dispatch_forever)); ^~~~~ /home/Code/mbed-test/mbed-os/drivers/source/usb/USBCDC_ECM.cpp:81:38: error: 'events' has not been declared _thread.start(callback(&_queue, &events::EventQueue::dispatch_forever)); ^~~~~ /home/Code/mbed-test/mbed-os/drivers/source/usb/USBCDC_ECM.cpp:81:74: error: 'callback' was not declared in this scope _thread.start(callback(&_queue, &events::EventQueue::dispatch_forever));

Turns out there are multiple EventQueue.hs in the source tree and the ordering of the directories in CMakeLists.txt makes it grab the wrong one. Fixing the order in the generated CMakeList.txt made the problem go away. Seems like a bug.

posted by Brian Swenson 08 Nov 2019
Be the first to answer this question.