Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[teensy4] Rename USB sources from .c to .cpp to enable C++ features #1

Closed
wants to merge 6 commits into from

Conversation

forderud
Copy link
Owner

@forderud forderud commented Sep 23, 2024

Build errors:

  • error: 'usb_string_manufacturer_name' aliased to undefined symbol 'usb_string_manufacturer_name_default'
  • error: 'usb_string_product_name' aliased to undefined symbol 'usb_string_product_name_default'
  • error: 'yield' was not declared in this scope
  • error: 'millis' was not declared in this scope

Full build log:

C:\Users\100030120\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\cores\teensy4\usb_desc.cpp:2722:44: error: 'usb_string_manufacturer_name' aliased to undefined symbol 'usb_string_manufacturer_name_default'
 2722 | extern struct usb_string_descriptor_struct usb_string_manufacturer_name
      |                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\100030120\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\cores\teensy4\usb_desc.cpp:2724:44: error: 'usb_string_product_name' aliased to undefined symbol 'usb_string_product_name_default'
 2724 | extern struct usb_string_descriptor_struct usb_string_product_name
      |                                            ^~~~~~~~~~~~~~~~~~~~~~~
In file included from C:\Users\100030120\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\cores\teensy4\usb.cpp:4:
C:\Users\100030120\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\cores\teensy4\usb_serial.h: In member function 'void usb_serial_class::begin(long int)':
C:\Users\100030120\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\cores\teensy4\usb_serial.h:93:25: error: 'yield' was not declared in this scope
   93 |                         yield();
      |                         ^~~~~
C:\Users\100030120\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\cores\teensy4\usb_serial.h: In member function 'usb_serial_class::operator bool()':
C:\Users\100030120\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\cores\teensy4\usb_serial.h:167:17: error: 'yield' was not declared in this scope
  167 |                 yield();
      |                 ^~~~~
C:\Users\100030120\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\cores\teensy4\usb_serial.h: In member function 'size_t usb_serial_class::readBytes(char*, size_t)':
C:\Users\100030120\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\cores\teensy4\usb_serial.h:177:45: error: 'millis' was not declared in this scope
  177 |                 unsigned long startMillis = millis();
      |                                             ^~~~~~
In file included from C:\Users\100030120\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\cores\teensy4\usb_serial.cpp:32:
C:\Users\100030120\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\cores\teensy4\usb_serial.h: In member function 'void usb_serial_class::begin(long int)':
C:\Users\100030120\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\cores\teensy4\usb_serial.h:93:25: error: 'yield' was not declared in this scope
   93 |                         yield();
      |                         ^~~~~
C:\Users\100030120\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\cores\teensy4\usb_serial.h: In member function 'usb_serial_class::operator bool()':
C:\Users\100030120\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\cores\teensy4\usb_serial.h:167:17: error: 'yield' was not declared in this scope
  167 |                 yield();
      |                 ^~~~~
C:\Users\100030120\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\cores\teensy4\usb_serial.h: In member function 'size_t usb_serial_class::readBytes(char*, size_t)':
C:\Users\100030120\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\cores\teensy4\usb_serial.h:177:45: error: 'millis' was not declared in this scope
  177 |                 unsigned long startMillis = millis();
      |                                             ^~~~~~
C:\Users\100030120\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\cores\teensy4\usb_serial.cpp: In function 'void rx_event(transfer_t*)':
C:\Users\100030120\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\cores\teensy4\usb_serial.cpp:157:33: warning: comparison of integer expressions of different signedness: 'int' and 'long unsigned int' [-Wsign-compare]
  157 |                         if (len <= CDC_RX_SIZE_480 - count) {
      |                             ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:\Users\100030120\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\cores\teensy4\usb_serial2.cpp:32:
C:\Users\100030120\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\cores\teensy4\usb_serial.h: In member function 'void usb_serial_class::begin(long int)':
C:\Users\100030120\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\cores\teensy4\usb_serial.h:93:25: error: 'yield' was not declared in this scope
   93 |                         yield();
      |                         ^~~~~
C:\Users\100030120\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\cores\teensy4\usb_serial.h: In member function 'usb_serial_class::operator bool()':
C:\Users\100030120\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\cores\teensy4\usb_serial.h:167:17: error: 'yield' was not declared in this scope
  167 |                 yield();
      |                 ^~~~~
C:\Users\100030120\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\cores\teensy4\usb_serial.h: In member function 'size_t usb_serial_class::readBytes(char*, size_t)':
C:\Users\100030120\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\cores\teensy4\usb_serial.h:177:45: error: 'millis' was not declared in this scope
  177 |                 unsigned long startMillis = millis();
      |                                             ^~~~~~
In file included from C:\Users\100030120\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\cores\teensy4\usb_serial3.cpp:32:
C:\Users\100030120\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\cores\teensy4\usb_serial.h: In member function 'void usb_serial_class::begin(long int)':
C:\Users\100030120\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\cores\teensy4\usb_serial.h:93:25: error: 'yield' was not declared in this scope
   93 |                         yield();
      |                         ^~~~~
C:\Users\100030120\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\cores\teensy4\usb_serial.h: In member function 'usb_serial_class::operator bool()':
C:\Users\100030120\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\cores\teensy4\usb_serial.h:167:17: error: 'yield' was not declared in this scope
  167 |                 yield();
      |                 ^~~~~
C:\Users\100030120\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\cores\teensy4\usb_serial.h: In member function 'size_t usb_serial_class::readBytes(char*, size_t)':
C:\Users\100030120\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\cores\teensy4\usb_serial.h:177:45: error: 'millis' was not declared in this scope
  177 |                 unsigned long startMillis = millis();
      |                                             ^~~~~~

exit status 1

Compilation error: exit status 1

Done to fix the following errors if attempting to compile usb_serial.h as C++ code:
usb_serial.h:93:25: error: 'yield' was not declared in this scope
usb_serial.h:177:45: error: 'millis' was not declared in this scope
@forderud
Copy link
Owner Author

Moved to PaulStoffregen#763

@forderud forderud closed this Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant