Error Linking CXX executable when compiling with TinyUSB on a separate file.

Aggeloz
Posts: 2
Joined: Sun Apr 09, 2023 5:55 pm

Error Linking CXX executable when compiling with TinyUSB on a separate file.

Postby Aggeloz » Sun Apr 09, 2023 6:08 pm

Im having issues compiling this code as two separate files even tho the same code compiles when its in one file. Mind you im using C++ instead of C because of the ArduinoJSON Library.
  1. /*
  2.  * SPDX-FileCopyrightText: 2010-2022 Espressif Systems (Shanghai) CO LTD
  3.  *
  4.  * SPDX-License-Identifier: CC0-1.0
  5.  */
  6.  
  7. #include "sdkconfig.h"
  8. #include "rotary.cpp"
  9. #include "setUsb.cpp"
  10.  
  11. static const char *TAG = "BlackBox";
  12.  
  13. #define APP_BUTTON (GPIO_NUM_0) // Use BOOT signal by default
  14.  
  15. extern "C" { void app_main(void); }
  16.  
  17. void app_main(void)
  18. {
  19.     // Initialize button that will trigger HID reports
  20.     const gpio_config_t boot_button_config = {
  21.         .pin_bit_mask = BIT64(APP_BUTTON),
  22.         .mode = GPIO_MODE_INPUT,
  23.         .pull_up_en = GPIO_PULLUP_ENABLE,
  24.         .pull_down_en = GPIO_PULLDOWN_DISABLE,
  25.         .intr_type = GPIO_INTR_DISABLE,
  26.     };
  27.  
  28.     ESP_ERROR_CHECK(gpio_config(&boot_button_config));
  29.  
  30.  
  31.     initRot();
  32.     installUSB();
  33.     // Report counter value
  34.     int pulse_count = 0;
  35.     int event_count = 0;
  36.     while (1)
  37.     {
  38.         if (xQueueReceive(queue, &event_count, pdMS_TO_TICKS(1000)))
  39.         {
  40.             ESP_LOGI(TAG, "Watch point event, count: %d", event_count);
  41.         }
  42.         else
  43.         {
  44.             ESP_ERROR_CHECK(pcnt_unit_get_count(pcnt_unit, &pulse_count));
  45.             ESP_LOGI(TAG, "Pulse count: %d", pulse_count);
  46.         }
  47.  
  48.         if(tud_mounted()) {
  49.             static bool send_hid_data = true;
  50.             if(send_hid_data) {
  51.                 app_send_hid_demo();
  52.             }
  53.             // send_hid_data = !gpio_get_level(APP_BUTTON);
  54.         }
  55.     }
  56. }
  57.  
  1. #include <stdlib.h>
  2. #include "esp_log.h"
  3. #include "freertos/FreeRTOS.h"
  4. #include "freertos/task.h"
  5. #include "tinyusb.h"
  6. #include "class/hid/hid_device.h"
  7. #include <driver/gpio.h>
  8. #include <ArduinoJson.h>
  9. #include "driver/pulse_cnt.h"
  10. #include "esp_sleep.h"
  11.  
  12.  
  13.  
  14. static const char *usbTAG = "BlackBox";
  15. #define TUSB_DESC_TOTAL_LEN (TUD_CONFIG_DESC_LEN + CFG_TUD_HID * TUD_HID_DESC_LEN)
  16.  
  17.     /**
  18.      * @brief HID report descriptor
  19.      *
  20.      * In this example we implement Keyboard + Mouse HID device,
  21.      * so we must define both report descriptors
  22.      */
  23.     const uint8_t hid_report_descriptor[] = {
  24.         // TUD_HID_REPORT_DESC_GENERIC_INOUT(NULL), // I dont know if this is a good idea
  25.         TUD_HID_REPORT_DESC_GENERIC_INOUT(100),
  26.     };
  27.  
  28.     /**
  29.      * @brief String descriptor
  30.      */
  31.     const char *hid_string_descriptor[5] = {
  32.         // array of pointer to string descriptors
  33.         (char[]){0x09, 0x04},    // 0: is supported language is English (0x0409)
  34.         "BlackBox",              // 1: Manufacturer
  35.         "BlackBox Device",       // 2: Product
  36.         "123456",                // 3: Serials, should use chip ID
  37.         "Example HID interface", // 4: HID
  38.     };
  39.  
  40.     /**
  41.      * @brief Configuration descriptor
  42.      *
  43.      * This is a simple configuration descriptor that defines 1 configuration and 1 HID interface
  44.      */
  45.     static const uint8_t hid_configuration_descriptor[] = {
  46.         // Configuration number, interface count, string index, total length, attribute, power in mA
  47.         TUD_CONFIG_DESCRIPTOR(1, 1, 0, TUSB_DESC_TOTAL_LEN, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 100),
  48.  
  49.         // Interface number, string index, boot protocol, report descriptor len, EP In address, size & polling interval
  50.         TUD_HID_DESCRIPTOR(0, 4, false, sizeof(hid_report_descriptor), 0x81, 16, 10),
  51.     };
  52.  
  53.     /********* TinyUSB HID callbacks ***************/
  54.  
  55.     // Invoked when received GET HID REPORT DESCRIPTOR request
  56.     // Application return pointer to descriptor, whose contents must exist long enough for transfer to complete
  57.     uint8_t const *tud_hid_descriptor_report_cb(uint8_t instance)
  58.     {
  59.         // We use only one interface and one HID report descriptor, so we can ignore parameter 'instance'
  60.         return hid_report_descriptor;
  61.     }
  62.  
  63.     // Invoked when received GET_REPORT control request
  64.     // Application must fill buffer report's content and return its length.
  65.     // Return zero will cause the stack to STALL request
  66.     uint16_t tud_hid_get_report_cb(uint8_t instance, uint8_t report_id, hid_report_type_t report_type, uint8_t *buffer, uint16_t reqlen)
  67.     {
  68.         (void)instance;
  69.         (void)report_id;
  70.         (void)report_type;
  71.         (void)buffer;
  72.         (void)reqlen;
  73.  
  74.         return 0;
  75.     }
  76.  
  77.     // Invoked when received SET_REPORT control request or
  78.     // received data on OUT endpoint ( Report ID = 0, Type = 0 )
  79.     void tud_hid_set_report_cb(uint8_t instance, uint8_t report_id, hid_report_type_t report_type, uint8_t const *buffer, uint16_t bufsize)
  80.     {
  81.     }
  82.  
  83.     void installUSB()
  84.     {
  85.         ESP_LOGI(usbTAG, "USB initialization");
  86.         const tinyusb_config_t tusb_cfg = {
  87.             .device_descriptor = NULL,
  88.             .string_descriptor = hid_string_descriptor,
  89.             .string_descriptor_count = sizeof(hid_string_descriptor) / sizeof(hid_string_descriptor[0]),
  90.             .external_phy = false,
  91.             .configuration_descriptor = hid_configuration_descriptor,
  92.         };
  93.         ESP_ERROR_CHECK(tinyusb_driver_install(&tusb_cfg));
  94.         ESP_LOGI(usbTAG, "USB initialization DONE");
  95.     }
  96.  
  97.  
  98.  
  99.     DynamicJsonDocument doc(1024);
  100.     char cmd[256];
  101.     static void app_send_hid_demo(void)
  102.     {
  103.  
  104.         doc["cmd"] = "sndLvl1";
  105.         serializeJson(doc, cmd);
  106.  
  107.         ESP_LOGI(usbTAG, "Sending USB Report");
  108.         tud_hid_report(0, cmd, strlen(cmd));
  109.     }
  110.  
  111.  
  112.  
  113.  
This is the error

Code: Select all

[1/1] cd /home/edgie/esp/read_rotary/build/bootloader/esp-idf/esptool_py && /home/edgie/.espr...--offset 0x8000 bootloader 0x1000 /home/edgie/esp/read_rotary/build/bootloader/bootloader.binBootloader binary size 0x5440 bytes. 0x1bc0 bytes (25%) free.
[2/4] Linking CXX executable read_rotary.elfFAILED: read_rotary.elf 
: && /home/edgie/.espressif/tools/xtensa-esp32s2-elf/esp-12.2.0_20230208/xtensa-esp32s2-elf/bin/xtensa-esp32s2-elf-g++ -mlongcalls  -g -Wl,--cref -Wl,--defsym=IDF_TARGET_ESP32S2=0 -Wl,--Map=/home/edgie/esp/read_rotary/build/read_rotary.map -Wl,--no-warn-rwx-segments -fno-rtti -fno-lto -Wl,--gc-sections -Wl,--warn-common -T esp32s2.peripherals.ld -T esp32s2.rom.ld -T esp32s2.rom.api.ld -T esp32s2.rom.libgcc.ld -T esp32s2.rom.newlib-funcs.ld -T esp32s2.rom.newlib-data.ld -T esp32s2.rom.spiflash.ld -T memory.ld -T sections.ld CMakeFiles/read_rotary.elf.dir/project_elf_src_esp32s2.c.obj -o read_rotary.elf -L/home/edgie/esp/esp-idf/components/soc/esp32s2/ld   -L/home/edgie/esp/esp-idf/components/esp_rom/esp32s2/ld   -L/home/edgie/esp/read_rotary/build/esp-idf/esp_system/ld   -L/home/edgie/esp/esp-idf/components/esp_phy/lib/esp32s2   -L/home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2 esp-idf/xtensa/libxtensa.a  esp-idf/esp_ringbuf/libesp_ringbuf.a  esp-idf/efuse/libefuse.a  esp-idf/driver/libdriver.a  esp-idf/esp_pm/libesp_pm.a  esp-idf/mbedtls/libmbedtls.a  esp-idf/esp_app_format/libesp_app_format.a  esp-idf/bootloader_support/libbootloader_support.a  esp-idf/esp_partition/libesp_partition.a  esp-idf/app_update/libapp_update.a  esp-idf/esp_mm/libesp_mm.a  esp-idf/spi_flash/libspi_flash.a  esp-idf/pthread/libpthread.a  esp-idf/esp_system/libesp_system.a  esp-idf/esp_rom/libesp_rom.a  esp-idf/hal/libhal.a  esp-idf/log/liblog.a  esp-idf/heap/libheap.a  esp-idf/soc/libsoc.a  esp-idf/esp_hw_support/libesp_hw_support.a  esp-idf/freertos/libfreertos.a  esp-idf/newlib/libnewlib.a  esp-idf/cxx/libcxx.a  esp-idf/esp_common/libesp_common.a  esp-idf/esp_timer/libesp_timer.a  esp-idf/app_trace/libapp_trace.a  esp-idf/esp_event/libesp_event.a  esp-idf/nvs_flash/libnvs_flash.a  esp-idf/esp_phy/libesp_phy.a  esp-idf/vfs/libvfs.a  esp-idf/lwip/liblwip.a  esp-idf/esp_netif/libesp_netif.a  esp-idf/wpa_supplicant/libwpa_supplicant.a  esp-idf/esp_coex/libesp_coex.a  esp-idf/esp_wifi/libesp_wifi.a  esp-idf/unity/libunity.a  esp-idf/cmock/libcmock.a  esp-idf/console/libconsole.a  esp-idf/http_parser/libhttp_parser.a  esp-idf/esp-tls/libesp-tls.a  esp-idf/esp_adc/libesp_adc.a  esp-idf/esp_eth/libesp_eth.a  esp-idf/esp_gdbstub/libesp_gdbstub.a  esp-idf/esp_hid/libesp_hid.a  esp-idf/tcp_transport/libtcp_transport.a  esp-idf/esp_http_client/libesp_http_client.a  esp-idf/esp_http_server/libesp_http_server.a  esp-idf/esp_https_ota/libesp_https_ota.a  esp-idf/esp_lcd/libesp_lcd.a  esp-idf/protobuf-c/libprotobuf-c.a  esp-idf/protocomm/libprotocomm.a  esp-idf/esp_local_ctrl/libesp_local_ctrl.a  esp-idf/espcoredump/libespcoredump.a  esp-idf/wear_levelling/libwear_levelling.a  esp-idf/sdmmc/libsdmmc.a  esp-idf/fatfs/libfatfs.a  esp-idf/json/libjson.a  esp-idf/mqtt/libmqtt.a  esp-idf/perfmon/libperfmon.a  esp-idf/spiffs/libspiffs.a  esp-idf/touch_element/libtouch_element.a  esp-idf/ulp/libulp.a  esp-idf/usb/libusb.a  esp-idf/wifi_provisioning/libwifi_provisioning.a  esp-idf/espressif__tinyusb/libespressif__tinyusb.a  esp-idf/espressif__esp_tinyusb/libespressif__esp_tinyusb.a  esp-idf/main/libmain.a  esp-idf/app_trace/libapp_trace.a  esp-idf/unity/libunity.a  esp-idf/protocomm/libprotocomm.a  esp-idf/console/libconsole.a  esp-idf/protobuf-c/libprotobuf-c.a  esp-idf/json/libjson.a  esp-idf/espressif__esp_tinyusb/libespressif__esp_tinyusb.a  esp-idf/fatfs/libfatfs.a  esp-idf/wear_levelling/libwear_levelling.a  esp-idf/sdmmc/libsdmmc.a  esp-idf/usb/libusb.a  esp-idf/espressif__tinyusb/libespressif__tinyusb.a  esp-idf/xtensa/libxtensa.a  esp-idf/esp_ringbuf/libesp_ringbuf.a  esp-idf/efuse/libefuse.a  esp-idf/driver/libdriver.a  esp-idf/esp_pm/libesp_pm.a  esp-idf/mbedtls/libmbedtls.a  esp-idf/esp_app_format/libesp_app_format.a  esp-idf/bootloader_support/libbootloader_support.a  esp-idf/esp_partition/libesp_partition.a  esp-idf/app_update/libapp_update.a  esp-idf/esp_mm/libesp_mm.a  esp-idf/spi_flash/libspi_flash.a  esp-idf/pthread/libpthread.a  esp-idf/esp_system/libesp_system.a  esp-idf/esp_rom/libesp_rom.a  esp-idf/hal/libhal.a  esp-idf/log/liblog.a  esp-idf/heap/libheap.a  esp-idf/soc/libsoc.a  esp-idf/esp_hw_support/libesp_hw_support.a  esp-idf/freertos/libfreertos.a  esp-idf/newlib/libnewlib.a  esp-idf/cxx/libcxx.a  esp-idf/esp_common/libesp_common.a  esp-idf/esp_timer/libesp_timer.a  esp-idf/esp_event/libesp_event.a  esp-idf/nvs_flash/libnvs_flash.a  esp-idf/esp_phy/libesp_phy.a  esp-idf/vfs/libvfs.a  esp-idf/lwip/liblwip.a  esp-idf/esp_netif/libesp_netif.a  esp-idf/wpa_supplicant/libwpa_supplicant.a  esp-idf/esp_coex/libesp_coex.a  esp-idf/esp_wifi/libesp_wifi.a  esp-idf/http_parser/libhttp_parser.a  esp-idf/esp-tls/libesp-tls.a  esp-idf/esp_adc/libesp_adc.a  esp-idf/esp_eth/libesp_eth.a  esp-idf/esp_gdbstub/libesp_gdbstub.a  esp-idf/tcp_transport/libtcp_transport.a  esp-idf/esp_http_client/libesp_http_client.a  esp-idf/esp_http_server/libesp_http_server.a  esp-idf/esp_https_ota/libesp_https_ota.a  esp-idf/ulp/libulp.a  esp-idf/mbedtls/mbedtls/library/libmbedtls.a  esp-idf/mbedtls/mbedtls/library/libmbedcrypto.a  esp-idf/mbedtls/mbedtls/library/libmbedx509.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libcore.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libespnow.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libmesh.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libnet80211.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libpp.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libsmartconfig.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libwapi.a  esp-idf/xtensa/libxtensa.a  esp-idf/esp_ringbuf/libesp_ringbuf.a  esp-idf/efuse/libefuse.a  esp-idf/driver/libdriver.a  esp-idf/esp_pm/libesp_pm.a  esp-idf/mbedtls/libmbedtls.a  esp-idf/esp_app_format/libesp_app_format.a  esp-idf/bootloader_support/libbootloader_support.a  esp-idf/esp_partition/libesp_partition.a  esp-idf/app_update/libapp_update.a  esp-idf/esp_mm/libesp_mm.a  esp-idf/spi_flash/libspi_flash.a  esp-idf/pthread/libpthread.a  esp-idf/esp_system/libesp_system.a  esp-idf/esp_rom/libesp_rom.a  esp-idf/hal/libhal.a  esp-idf/log/liblog.a  esp-idf/heap/libheap.a  esp-idf/soc/libsoc.a  esp-idf/esp_hw_support/libesp_hw_support.a  esp-idf/freertos/libfreertos.a  esp-idf/newlib/libnewlib.a  esp-idf/cxx/libcxx.a  esp-idf/esp_common/libesp_common.a  esp-idf/esp_timer/libesp_timer.a  esp-idf/esp_event/libesp_event.a  esp-idf/nvs_flash/libnvs_flash.a  esp-idf/esp_phy/libesp_phy.a  esp-idf/vfs/libvfs.a  esp-idf/lwip/liblwip.a  esp-idf/esp_netif/libesp_netif.a  esp-idf/wpa_supplicant/libwpa_supplicant.a  esp-idf/esp_coex/libesp_coex.a  esp-idf/esp_wifi/libesp_wifi.a  esp-idf/http_parser/libhttp_parser.a  esp-idf/esp-tls/libesp-tls.a  esp-idf/esp_adc/libesp_adc.a  esp-idf/esp_eth/libesp_eth.a  esp-idf/esp_gdbstub/libesp_gdbstub.a  esp-idf/tcp_transport/libtcp_transport.a  esp-idf/esp_http_client/libesp_http_client.a  esp-idf/esp_http_server/libesp_http_server.a  esp-idf/esp_https_ota/libesp_https_ota.a  esp-idf/ulp/libulp.a  esp-idf/mbedtls/mbedtls/library/libmbedtls.a  esp-idf/mbedtls/mbedtls/library/libmbedcrypto.a  esp-idf/mbedtls/mbedtls/library/libmbedx509.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libcore.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libespnow.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libmesh.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libnet80211.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libpp.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libsmartconfig.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libwapi.a  esp-idf/xtensa/libxtensa.a  esp-idf/esp_ringbuf/libesp_ringbuf.a  esp-idf/efuse/libefuse.a  esp-idf/driver/libdriver.a  esp-idf/esp_pm/libesp_pm.a  esp-idf/mbedtls/libmbedtls.a  esp-idf/esp_app_format/libesp_app_format.a  esp-idf/bootloader_support/libbootloader_support.a  esp-idf/esp_partition/libesp_partition.a  esp-idf/app_update/libapp_update.a  esp-idf/esp_mm/libesp_mm.a  esp-idf/spi_flash/libspi_flash.a  esp-idf/pthread/libpthread.a  esp-idf/esp_system/libesp_system.a  esp-idf/esp_rom/libesp_rom.a  esp-idf/hal/libhal.a  esp-idf/log/liblog.a  esp-idf/heap/libheap.a  esp-idf/soc/libsoc.a  esp-idf/esp_hw_support/libesp_hw_support.a  esp-idf/freertos/libfreertos.a  esp-idf/newlib/libnewlib.a  esp-idf/cxx/libcxx.a  esp-idf/esp_common/libesp_common.a  esp-idf/esp_timer/libesp_timer.a  esp-idf/esp_event/libesp_event.a  esp-idf/nvs_flash/libnvs_flash.a  esp-idf/esp_phy/libesp_phy.a  esp-idf/vfs/libvfs.a  esp-idf/lwip/liblwip.a  esp-idf/esp_netif/libesp_netif.a  esp-idf/wpa_supplicant/libwpa_supplicant.a  esp-idf/esp_coex/libesp_coex.a  esp-idf/esp_wifi/libesp_wifi.a  esp-idf/http_parser/libhttp_parser.a  esp-idf/esp-tls/libesp-tls.a  esp-idf/esp_adc/libesp_adc.a  esp-idf/esp_eth/libesp_eth.a  esp-idf/esp_gdbstub/libesp_gdbstub.a  esp-idf/tcp_transport/libtcp_transport.a  esp-idf/esp_http_client/libesp_http_client.a  esp-idf/esp_http_server/libesp_http_server.a  esp-idf/esp_https_ota/libesp_https_ota.a  esp-idf/ulp/libulp.a  esp-idf/mbedtls/mbedtls/library/libmbedtls.a  esp-idf/mbedtls/mbedtls/library/libmbedcrypto.a  esp-idf/mbedtls/mbedtls/library/libmbedx509.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libcore.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libespnow.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libmesh.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libnet80211.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libpp.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libsmartconfig.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libwapi.a  esp-idf/xtensa/libxtensa.a  esp-idf/esp_ringbuf/libesp_ringbuf.a  esp-idf/efuse/libefuse.a  esp-idf/driver/libdriver.a  esp-idf/esp_pm/libesp_pm.a  esp-idf/mbedtls/libmbedtls.a  esp-idf/esp_app_format/libesp_app_format.a  esp-idf/bootloader_support/libbootloader_support.a  esp-idf/esp_partition/libesp_partition.a  esp-idf/app_update/libapp_update.a  esp-idf/esp_mm/libesp_mm.a  esp-idf/spi_flash/libspi_flash.a  esp-idf/pthread/libpthread.a  esp-idf/esp_system/libesp_system.a  esp-idf/esp_rom/libesp_rom.a  esp-idf/hal/libhal.a  esp-idf/log/liblog.a  esp-idf/heap/libheap.a  esp-idf/soc/libsoc.a  esp-idf/esp_hw_support/libesp_hw_support.a  esp-idf/freertos/libfreertos.a  esp-idf/newlib/libnewlib.a  esp-idf/cxx/libcxx.a  esp-idf/esp_common/libesp_common.a  esp-idf/esp_timer/libesp_timer.a  esp-idf/esp_event/libesp_event.a  esp-idf/nvs_flash/libnvs_flash.a  esp-idf/esp_phy/libesp_phy.a  esp-idf/vfs/libvfs.a  esp-idf/lwip/liblwip.a  esp-idf/esp_netif/libesp_netif.a  esp-idf/wpa_supplicant/libwpa_supplicant.a  esp-idf/esp_coex/libesp_coex.a  esp-idf/esp_wifi/libesp_wifi.a  esp-idf/http_parser/libhttp_parser.a  esp-idf/esp-tls/libesp-tls.a  esp-idf/esp_adc/libesp_adc.a  esp-idf/esp_eth/libesp_eth.a  esp-idf/esp_gdbstub/libesp_gdbstub.a  esp-idf/tcp_transport/libtcp_transport.a  esp-idf/esp_http_client/libesp_http_client.a  esp-idf/esp_http_server/libesp_http_server.a  esp-idf/esp_https_ota/libesp_https_ota.a  esp-idf/ulp/libulp.a  esp-idf/mbedtls/mbedtls/library/libmbedtls.a  esp-idf/mbedtls/mbedtls/library/libmbedcrypto.a  esp-idf/mbedtls/mbedtls/library/libmbedx509.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libcore.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libespnow.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libmesh.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libnet80211.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libpp.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libsmartconfig.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libwapi.a  esp-idf/xtensa/libxtensa.a  esp-idf/esp_ringbuf/libesp_ringbuf.a  esp-idf/efuse/libefuse.a  esp-idf/driver/libdriver.a  esp-idf/esp_pm/libesp_pm.a  esp-idf/mbedtls/libmbedtls.a  esp-idf/esp_app_format/libesp_app_format.a  esp-idf/bootloader_support/libbootloader_support.a  esp-idf/esp_partition/libesp_partition.a  esp-idf/app_update/libapp_update.a  esp-idf/esp_mm/libesp_mm.a  esp-idf/spi_flash/libspi_flash.a  esp-idf/pthread/libpthread.a  esp-idf/esp_system/libesp_system.a  esp-idf/esp_rom/libesp_rom.a  esp-idf/hal/libhal.a  esp-idf/log/liblog.a  esp-idf/heap/libheap.a  esp-idf/soc/libsoc.a  esp-idf/esp_hw_support/libesp_hw_support.a  esp-idf/freertos/libfreertos.a  esp-idf/newlib/libnewlib.a  esp-idf/cxx/libcxx.a  esp-idf/esp_common/libesp_common.a  esp-idf/esp_timer/libesp_timer.a  esp-idf/esp_event/libesp_event.a  esp-idf/nvs_flash/libnvs_flash.a  esp-idf/esp_phy/libesp_phy.a  esp-idf/vfs/libvfs.a  esp-idf/lwip/liblwip.a  esp-idf/esp_netif/libesp_netif.a  esp-idf/wpa_supplicant/libwpa_supplicant.a  esp-idf/esp_coex/libesp_coex.a  esp-idf/esp_wifi/libesp_wifi.a  esp-idf/http_parser/libhttp_parser.a  esp-idf/esp-tls/libesp-tls.a  esp-idf/esp_adc/libesp_adc.a  esp-idf/esp_eth/libesp_eth.a  esp-idf/esp_gdbstub/libesp_gdbstub.a  esp-idf/tcp_transport/libtcp_transport.a  esp-idf/esp_http_client/libesp_http_client.a  esp-idf/esp_http_server/libesp_http_server.a  esp-idf/esp_https_ota/libesp_https_ota.a  esp-idf/ulp/libulp.a  esp-idf/mbedtls/mbedtls/library/libmbedtls.a  esp-idf/mbedtls/mbedtls/library/libmbedcrypto.a  esp-idf/mbedtls/mbedtls/library/libmbedx509.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libcore.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libespnow.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libmesh.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libnet80211.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libpp.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libsmartconfig.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libwapi.a  esp-idf/xtensa/libxtensa.a  esp-idf/esp_ringbuf/libesp_ringbuf.a  esp-idf/efuse/libefuse.a  esp-idf/driver/libdriver.a  esp-idf/esp_pm/libesp_pm.a  esp-idf/mbedtls/libmbedtls.a  esp-idf/esp_app_format/libesp_app_format.a  esp-idf/bootloader_support/libbootloader_support.a  esp-idf/esp_partition/libesp_partition.a  esp-idf/app_update/libapp_update.a  esp-idf/esp_mm/libesp_mm.a  esp-idf/spi_flash/libspi_flash.a  esp-idf/pthread/libpthread.a  esp-idf/esp_system/libesp_system.a  esp-idf/esp_rom/libesp_rom.a  esp-idf/hal/libhal.a  esp-idf/log/liblog.a  esp-idf/heap/libheap.a  esp-idf/soc/libsoc.a  esp-idf/esp_hw_support/libesp_hw_support.a  esp-idf/freertos/libfreertos.a  esp-idf/newlib/libnewlib.a  esp-idf/cxx/libcxx.a  esp-idf/esp_common/libesp_common.a  esp-idf/esp_timer/libesp_timer.a  esp-idf/esp_event/libesp_event.a  esp-idf/nvs_flash/libnvs_flash.a  esp-idf/esp_phy/libesp_phy.a  esp-idf/vfs/libvfs.a  esp-idf/lwip/liblwip.a  esp-idf/esp_netif/libesp_netif.a  esp-idf/wpa_supplicant/libwpa_supplicant.a  esp-idf/esp_coex/libesp_coex.a  esp-idf/esp_wifi/libesp_wifi.a  esp-idf/http_parser/libhttp_parser.a  esp-idf/esp-tls/libesp-tls.a  esp-idf/esp_adc/libesp_adc.a  esp-idf/esp_eth/libesp_eth.a  esp-idf/esp_gdbstub/libesp_gdbstub.a  esp-idf/tcp_transport/libtcp_transport.a  esp-idf/esp_http_client/libesp_http_client.a  esp-idf/esp_http_server/libesp_http_server.a  esp-idf/esp_https_ota/libesp_https_ota.a  esp-idf/ulp/libulp.a  esp-idf/mbedtls/mbedtls/library/libmbedtls.a  esp-idf/mbedtls/mbedtls/library/libmbedcrypto.a  esp-idf/mbedtls/mbedtls/library/libmbedx509.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libcore.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libespnow.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libmesh.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libnet80211.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libpp.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libsmartconfig.a  /home/edgie/esp/esp-idf/components/esp_wifi/lib/esp32s2/libwapi.a  /home/edgie/esp/esp-idf/components/xtensa/esp32s2/libxt_hal.a  -u esp_app_desc  -u pthread_include_pthread_impl  -u pthread_include_pthread_cond_impl  -u pthread_include_pthread_local_storage_impl  -u pthread_include_pthread_rwlock_impl  -u pthread_include_pthread_semaphore_impl  -u ld_include_highint_hdl  -u start_app  -u __ubsan_include  -Wl,--wrap=longjmp  -u __assert_func  -Wl,--undefined=uxTopUsedPriority  -Wl,--undefined=FreeRTOS_openocd_params  -u app_main  -lc  -lm  esp-idf/newlib/libnewlib.a  -u newlib_include_heap_impl  -u newlib_include_syscalls_impl  -u newlib_include_pthread_impl  -u newlib_include_assert_impl  -Wl,--wrap=_Unwind_SetEnableExceptionFdeSorting  -Wl,--wrap=__register_frame_info_bases  -Wl,--wrap=__register_frame_info  -Wl,--wrap=__register_frame  -Wl,--wrap=__register_frame_info_table_bases  -Wl,--wrap=__register_frame_info_table  -Wl,--wrap=__register_frame_table  -Wl,--wrap=__deregister_frame_info_bases  -Wl,--wrap=__deregister_frame_info  -Wl,--wrap=_Unwind_Find_FDE  -Wl,--wrap=_Unwind_GetGR  -Wl,--wrap=_Unwind_GetCFA  -Wl,--wrap=_Unwind_GetIP  -Wl,--wrap=_Unwind_GetIPInfo  -Wl,--wrap=_Unwind_GetRegionStart  -Wl,--wrap=_Unwind_GetDataRelBase  -Wl,--wrap=_Unwind_GetTextRelBase  -Wl,--wrap=_Unwind_SetIP  -Wl,--wrap=_Unwind_SetGR  -Wl,--wrap=_Unwind_GetLanguageSpecificData  -Wl,--wrap=_Unwind_FindEnclosingFunction  -Wl,--wrap=_Unwind_Resume  -Wl,--wrap=_Unwind_RaiseException  -Wl,--wrap=_Unwind_DeleteException  -Wl,--wrap=_Unwind_ForcedUnwind  -Wl,--wrap=_Unwind_Resume_or_Rethrow  -Wl,--wrap=_Unwind_Backtrace  -Wl,--wrap=__cxa_call_unexpected  -Wl,--wrap=__gxx_personality_v0  -u __cxa_guard_dummy  -lstdc++  esp-idf/pthread/libpthread.a  -lgcc  esp-idf/cxx/libcxx.a  -u __cxx_fatal_exception  -u include_esp_phy_override  -lphy  esp-idf/esp_phy/libesp_phy.a  -lphy  esp-idf/esp_phy/libesp_phy.a  -lphy  -u vfs_include_syscalls_impl && :
/home/edgie/.espressif/tools/xtensa-esp32s2-elf/esp-12.2.0_20230208/xtensa-esp32s2-elf/bin/../lib/gcc/xtensa-esp32s2-elf/12.2.0/../../../../xtensa-esp32s2-elf/bin/ld: esp-idf/main/libmain.a(read_rotary.cpp.obj):(.literal._ZL17app_send_hid_demov+0x1c): undefined reference to `tud_hid_n_report'
/home/edgie/.espressif/tools/xtensa-esp32s2-elf/esp-12.2.0_20230208/xtensa-esp32s2-elf/bin/../lib/gcc/xtensa-esp32s2-elf/12.2.0/../../../../xtensa-esp32s2-elf/bin/ld: esp-idf/main/libmain.a(read_rotary.cpp.obj): in function `_ZL17app_send_hid_demov':
/home/edgie/esp/read_rotary/main/setUsb.cpp:107: undefined reference to `tud_hid_n_report'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.


MicroController
Posts: 1709
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Error Linking CXX executable when compiling with TinyUSB on a separate file.

Postby MicroController » Wed Apr 12, 2023 7:06 am

You have to add the name of every source file (.c and .cpp) you need built/linked to your cmake list @

Code: Select all

idf_component_register(SRCS ...

Aggeloz
Posts: 2
Joined: Sun Apr 09, 2023 5:55 pm

Re: Error Linking CXX executable when compiling with TinyUSB on a separate file.

Postby Aggeloz » Thu Apr 13, 2023 11:12 am

MicroController wrote:
Wed Apr 12, 2023 7:06 am
You have to add the name of every source file (.c and .cpp) you need built/linked to your cmake list @

Code: Select all

idf_component_register(SRCS ...
Ive done this. Actually ive discovered with the help of the github repo that i had forgotten to change a setting in the menuconfig that basically tells how many HID devices should show up. It was default to 0 and somehow i overlooked it completely.

Who is online

Users browsing this forum: Baidu [Spider], cartersm57@gmail.com, Majestic-12 [Bot] and 108 guests