CPP: Invalid convertions and sorry-unimplemented's error while translating it from C

dmitrij999
Posts: 71
Joined: Sat Mar 02, 2019 8:06 pm

CPP: Invalid convertions and sorry-unimplemented's error while translating it from C

Postby dmitrij999 » Mon Apr 22, 2019 5:32 pm

I edit and try to convert the code in c++ but it gives the following error:

Code: Select all

dmitrij999@dmitrij999-Inspiron-3520:~/esp/a2dp_sink_cpp$ make
fatal: Not a git repository: /home/dmitrij999/esp/a2dp_sink/esp-idf/.git/modules/components/asio/asio
Toolchain path: /home/dmitrij999/esp/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
Toolchain version: crosstool-ng-1.22.0-80-g6c4433a
Compiler version: 5.2.0
fatal: Not a git repository: /home/dmitrij999/esp/a2dp_sink/esp-idf/.git/modules/components/asio/asio
Python requirements from /home/dmitrij999/esp/esp-idf/requirements.txt are satisfied.

Project is not inside a git repository, will not use 'git describe' to determine PROJECT_VER.
App "a2dp_sink" version: 1
CXX build/main/main.o
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:701:28: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix]
         ESP_LOGI(WIFI_TAG, "station:"MACSTR" join, AID=%d",
                            ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:706:28: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix]
         ESP_LOGI(WIFI_TAG, "station:"MACSTR"leave, AID=%d",
                            ^
In file included from /home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:42:0:
/home/dmitrij999/esp/a2dp_sink_cpp/main/fm_radio.h:199:45: note: offset of packed bit-field '<anonymous struct>::softBlendThreshold' has changed in GCC 4.4
 typedef struct __attribute__ ((__packed__)) {
                                             ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/fm_radio.h:199:45: note: offset of packed bit-field '<anonymous struct>::seekThresholdOld' has changed in GCC 4.4
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:92:18: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
 char *dev_name = "ESP_SPEAKER";
                  ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp: In function 'void blink_status(void*)':
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:162:11: warning: unused variable 'bt_state' [-Wunused-variable]
   uint8_t bt_state;
           ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp: In function 'void audio_init()':
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:216:5: sorry, unimplemented: non-trivial designated initializers not supported
     };
     ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:216:5: sorry, unimplemented: non-trivial designated initializers not supported
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:216:5: sorry, unimplemented: non-trivial designated initializers not supported
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:216:5: warning: missing initializer for member 'i2s_config_t::use_apll' [-Wmissing-field-initializers]
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:216:5: warning: missing initializer for member 'i2s_config_t::tx_desc_auto_clear' [-Wmissing-field-initializers]
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:216:5: warning: missing initializer for member 'i2s_config_t::fixed_mclk' [-Wmissing-field-initializers]
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp: In function 'void fmRSSI(void*)':
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:313:28: warning: unused variable 'radio' [-Wunused-variable]
  TRDA5807MRegisterFileRead radio;
                            ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp: In function 'char* get_content_type(const char*)':
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:400:13: error: invalid conversion from 'char' to 'char*' [-fpermissive]
     return *content_type;
             ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp: In function 'esp_err_t hello_get_handler(httpd_req_t*)':
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:414:21: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
         buf = malloc(buf_len);
                     ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:424:21: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
         buf = malloc(buf_len);
                     ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:433:21: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
         buf = malloc(buf_len);
                     ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:444:21: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
         buf = malloc(buf_len);
                     ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp: At global scope:
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:486:1: error: invalid conversion from 'const void*' to 'void*' [-fpermissive]
 };
 ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp: In function 'esp_err_t http_list_files(httpd_req_t*)':
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:589:44: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
     int files = count_files("/spiffs", NULL);
                                            ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:602:39: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
     f_list = file_list("/spiffs", NULL);
                                       ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:602:23: error: invalid conversion from 'const spiffs_file*' to 'spiffs_file*' [-fpermissive]
     f_list = file_list("/spiffs", NULL);
                       ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:613:21: error: invalid conversion from 'void*' to 'cJSON*' [-fpermissive]
     file_ls = malloc(files*512);
                     ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:570:18: warning: unused variable 'fmt' [-Wunused-variable]
     cJSON *root,*fmt;
                  ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:572:9: warning: unused variable 'char_ptr' [-Wunused-variable]
     int char_ptr = 0;
         ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:576:10: warning: unused variable 'buf' [-Wunused-variable]
     char buf;
          ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:577:9: warning: unused variable 'ret' [-Wunused-variable]
     int ret;
         ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp: In function 'void wifi_init_softap()':
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:737:5: error: C99 designator 'ssid' outside aggregate initializer
     };
     ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:737:5: error: C99 designator 'password' outside aggregate initializer
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:737:5: sorry, unimplemented: non-trivial designated initializers not supported
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:737:5: sorry, unimplemented: non-trivial designated initializers not supported
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:737:5: sorry, unimplemented: non-trivial designated initializers not supported
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:737:5: warning: missing initializer for member 'wifi_ap_config_t::ssid_hidden' [-Wmissing-field-initializers]
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:737:5: warning: missing initializer for member 'wifi_ap_config_t::max_connection' [-Wmissing-field-initializers]
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:737:5: warning: missing initializer for member 'wifi_ap_config_t::beacon_interval' [-Wmissing-field-initializers]
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp: In function 'void wifi_init_sta()':
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:764:5: error: C99 designator 'ssid' outside aggregate initializer
     };
     ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:764:5: error: C99 designator 'password' outside aggregate initializer
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:764:5: warning: missing initializer for member 'wifi_sta_config_t::scan_method' [-Wmissing-field-initializers]
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:764:5: warning: missing initializer for member 'wifi_sta_config_t::bssid_set' [-Wmissing-field-initializers]
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:764:5: warning: missing initializer for member 'wifi_sta_config_t::bssid' [-Wmissing-field-initializers]
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:764:5: warning: missing initializer for member 'wifi_sta_config_t::channel' [-Wmissing-field-initializers]
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:764:5: warning: missing initializer for member 'wifi_sta_config_t::listen_interval' [-Wmissing-field-initializers]
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:764:5: warning: missing initializer for member 'wifi_sta_config_t::sort_method' [-Wmissing-field-initializers]
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:764:5: warning: missing initializer for member 'wifi_sta_config_t::threshold' [-Wmissing-field-initializers]
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp: In function 'void app_main()':
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:785:44: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
     int files = count_files("/spiffs", NULL);
                                            ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:786:52: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
     spiffs_file *f_list = file_list("/spiffs", NULL);
                                                    ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:786:36: error: invalid conversion from 'const spiffs_file*' to 'spiffs_file*' [-fpermissive]
     spiffs_file *f_list = file_list("/spiffs", NULL);
                                    ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:797:58: error: cannot convert 'std::__cxx11::string {aka std::__cxx11::basic_string<char>}' to 'const char*' for argument '1' to 'char* get_content_type(const char*)'
     get_content_type(get_extension("web/html/index.html"));
                                                          ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:802:64: error: invalid conversion from 'int' to 'gpio_num_t' [-fpermissive]
  if ((err = i2c_master_init(I2C_NUM, I2C_SCL, I2C_SDA, I2C_FREQ)) != ESP_OK) {
                                                                ^
In file included from /home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:40:0:
/home/dmitrij999/esp/a2dp_sink_cpp/main/i2c_init.h:15:11: note:   initializing argument 2 of 'esp_err_t i2c_master_init(i2c_port_t, gpio_num_t, gpio_num_t, uint32_t)'
 esp_err_t i2c_master_init(i2c_port_t I2C_MASTER_NUM, gpio_num_t I2C_MASTER_SCL_
           ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:802:64: error: invalid conversion from 'int' to 'gpio_num_t' [-fpermissive]
  if ((err = i2c_master_init(I2C_NUM, I2C_SCL, I2C_SDA, I2C_FREQ)) != ESP_OK) {
                                                                ^
In file included from /home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:40:0:
/home/dmitrij999/esp/a2dp_sink_cpp/main/i2c_init.h:15:11: note:   initializing argument 3 of 'esp_err_t i2c_master_init(i2c_port_t, gpio_num_t, gpio_num_t, uint32_t)'
 esp_err_t i2c_master_init(i2c_port_t I2C_MASTER_NUM, gpio_num_t I2C_MASTER_SCL_
           ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp: In function 'void bt_av_hdl_stack_evt(uint16_t, void*)':
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:911:26: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
         char *dev_name = "ESP_SPEAKER";
                          ^
/home/dmitrij999/esp/esp-idf/make/component_wrapper.mk:289: ошибка выполнения рецепта для цели «main.o»
make[1]: *** [main.o] Ошибка 1
/home/dmitrij999/esp/esp-idf/make/project.mk:578: ошибка выполнения рецепта для цели «component-main-build»
make: *** [component-main-build] Ошибка 2
dmitrij999@dmitrij999-Inspiron-3520:~/esp/a2dp_sink_cpp$ make
fatal: Not a git repository: /home/dmitrij999/esp/a2dp_sink/esp-idf/.git/modules/components/asio/asio
Toolchain path: /home/dmitrij999/esp/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
Toolchain version: crosstool-ng-1.22.0-80-g6c4433a
Compiler version: 5.2.0
fatal: Not a git repository: /home/dmitrij999/esp/a2dp_sink/esp-idf/.git/modules/components/asio/asio
Python requirements from /home/dmitrij999/esp/esp-idf/requirements.txt are satisfied.

Project is not inside a git repository, will not use 'git describe' to determine PROJECT_VER.
App "a2dp_sink" version: 1
CXX build/main/main.o
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:695:28: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix]
         ESP_LOGI(WIFI_TAG, "station:"MACSTR" join, AID=%d",
                            ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:700:28: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix]
         ESP_LOGI(WIFI_TAG, "station:"MACSTR"leave, AID=%d",
                            ^
In file included from /home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:42:0:
/home/dmitrij999/esp/a2dp_sink_cpp/main/fm_radio.h:199:45: note: offset of packed bit-field '<anonymous struct>::softBlendThreshold' has changed in GCC 4.4
 typedef struct __attribute__ ((__packed__)) {
                                             ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/fm_radio.h:199:45: note: offset of packed bit-field '<anonymous struct>::seekThresholdOld' has changed in GCC 4.4
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:92:18: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
 char *dev_name = "ESP_SPEAKER";
                  ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp: In function 'void blink_status(void*)':
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:162:11: warning: unused variable 'bt_state' [-Wunused-variable]
   uint8_t bt_state;
           ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp: In function 'void audio_init()':
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:210:5: sorry, unimplemented: non-trivial designated initializers not supported
     };
     ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:210:5: sorry, unimplemented: non-trivial designated initializers not supported
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:210:5: sorry, unimplemented: non-trivial designated initializers not supported
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:210:5: warning: missing initializer for member 'i2s_config_t::use_apll' [-Wmissing-field-initializers]
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:210:5: warning: missing initializer for member 'i2s_config_t::tx_desc_auto_clear' [-Wmissing-field-initializers]
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:210:5: warning: missing initializer for member 'i2s_config_t::fixed_mclk' [-Wmissing-field-initializers]
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp: In function 'void fmRSSI(void*)':
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:307:28: warning: unused variable 'radio' [-Wunused-variable]
  TRDA5807MRegisterFileRead radio;
                            ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp: In function 'char* get_content_type(const char*)':
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:394:13: error: invalid conversion from 'char' to 'char*' [-fpermissive]
     return *content_type;
             ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp: In function 'esp_err_t hello_get_handler(httpd_req_t*)':
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:408:21: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
         buf = malloc(buf_len);
                     ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:418:21: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
         buf = malloc(buf_len);
                     ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:427:21: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
         buf = malloc(buf_len);
                     ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:438:21: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
         buf = malloc(buf_len);
                     ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp: At global scope:
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:480:1: error: invalid conversion from 'const void*' to 'void*' [-fpermissive]
 };
 ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp: In function 'esp_err_t http_list_files(httpd_req_t*)':
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:583:44: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
     int files = count_files("/spiffs", NULL);
                                            ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:596:39: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
     f_list = file_list("/spiffs", NULL);
                                       ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:596:23: error: invalid conversion from 'const spiffs_file*' to 'spiffs_file*' [-fpermissive]
     f_list = file_list("/spiffs", NULL);
                       ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:607:21: error: invalid conversion from 'void*' to 'cJSON*' [-fpermissive]
     file_ls = malloc(files*512);
                     ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:564:18: warning: unused variable 'fmt' [-Wunused-variable]
     cJSON *root,*fmt;
                  ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:566:9: warning: unused variable 'char_ptr' [-Wunused-variable]
     int char_ptr = 0;
         ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:570:10: warning: unused variable 'buf' [-Wunused-variable]
     char buf;
          ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:571:9: warning: unused variable 'ret' [-Wunused-variable]
     int ret;
         ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp: In function 'void wifi_init_softap()':
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:731:5: error: C99 designator 'ssid' outside aggregate initializer
     };
     ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:731:5: error: C99 designator 'password' outside aggregate initializer
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:731:5: sorry, unimplemented: non-trivial designated initializers not supported
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:731:5: sorry, unimplemented: non-trivial designated initializers not supported
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:731:5: sorry, unimplemented: non-trivial designated initializers not supported
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:731:5: warning: missing initializer for member 'wifi_ap_config_t::ssid_hidden' [-Wmissing-field-initializers]
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:731:5: warning: missing initializer for member 'wifi_ap_config_t::max_connection' [-Wmissing-field-initializers]
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:731:5: warning: missing initializer for member 'wifi_ap_config_t::beacon_interval' [-Wmissing-field-initializers]
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp: In function 'void wifi_init_sta()':
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:758:5: error: C99 designator 'ssid' outside aggregate initializer
     };
     ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:758:5: error: C99 designator 'password' outside aggregate initializer
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:758:5: warning: missing initializer for member 'wifi_sta_config_t::scan_method' [-Wmissing-field-initializers]
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:758:5: warning: missing initializer for member 'wifi_sta_config_t::bssid_set' [-Wmissing-field-initializers]
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:758:5: warning: missing initializer for member 'wifi_sta_config_t::bssid' [-Wmissing-field-initializers]
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:758:5: warning: missing initializer for member 'wifi_sta_config_t::channel' [-Wmissing-field-initializers]
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:758:5: warning: missing initializer for member 'wifi_sta_config_t::listen_interval' [-Wmissing-field-initializers]
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:758:5: warning: missing initializer for member 'wifi_sta_config_t::sort_method' [-Wmissing-field-initializers]
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:758:5: warning: missing initializer for member 'wifi_sta_config_t::threshold' [-Wmissing-field-initializers]
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp: In function 'void app_main()':
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:779:44: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
     int files = count_files("/spiffs", NULL);
                                            ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:780:52: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
     spiffs_file *f_list = file_list("/spiffs", NULL);
                                                    ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:780:36: error: invalid conversion from 'const spiffs_file*' to 'spiffs_file*' [-fpermissive]
     spiffs_file *f_list = file_list("/spiffs", NULL);
                                    ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:791:58: error: cannot convert 'std::__cxx11::string {aka std::__cxx11::basic_string<char>}' to 'const char*' for argument '1' to 'char* get_content_type(const char*)'
     get_content_type(get_extension("web/html/index.html"));
                                                          ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:796:64: error: invalid conversion from 'int' to 'gpio_num_t' [-fpermissive]
  if ((err = i2c_master_init(I2C_NUM, I2C_SCL, I2C_SDA, I2C_FREQ)) != ESP_OK) {
                                                                ^
In file included from /home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:40:0:
/home/dmitrij999/esp/a2dp_sink_cpp/main/i2c_init.h:15:11: note:   initializing argument 2 of 'esp_err_t i2c_master_init(i2c_port_t, gpio_num_t, gpio_num_t, uint32_t)'
 esp_err_t i2c_master_init(i2c_port_t I2C_MASTER_NUM, gpio_num_t I2C_MASTER_SCL_
           ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:796:64: error: invalid conversion from 'int' to 'gpio_num_t' [-fpermissive]
  if ((err = i2c_master_init(I2C_NUM, I2C_SCL, I2C_SDA, I2C_FREQ)) != ESP_OK) {
                                                                ^
In file included from /home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:40:0:
/home/dmitrij999/esp/a2dp_sink_cpp/main/i2c_init.h:15:11: note:   initializing argument 3 of 'esp_err_t i2c_master_init(i2c_port_t, gpio_num_t, gpio_num_t, uint32_t)'
 esp_err_t i2c_master_init(i2c_port_t I2C_MASTER_NUM, gpio_num_t I2C_MASTER_SCL_
           ^
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp: In function 'void bt_av_hdl_stack_evt(uint16_t, void*)':
/home/dmitrij999/esp/a2dp_sink_cpp/main/main.cpp:905:26: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
         char *dev_name = "ESP_SPEAKER";
                          ^
/home/dmitrij999/esp/esp-idf/make/component_wrapper.mk:289: ошибка выполнения рецепта для цели «main.o»
make[1]: *** [main.o] Ошибка 1
/home/dmitrij999/esp/esp-idf/make/project.mk:578: ошибка выполнения рецепта для цели «component-main-build»
make: *** [component-main-build] Ошибка 2

Explain me please what's the problem?
Attachments
main.cpp
(27.02 KiB) Downloaded 730 times
main.c
(26.88 KiB) Downloaded 700 times

ESP_Sprite
Posts: 9766
Joined: Thu Nov 26, 2015 4:08 am

Re: CPP: Invalid convertions and sorry-unimplemented's error while translating it from C

Postby ESP_Sprite » Tue Apr 23, 2019 3:43 am

There's not one problem here, there are a fair few. C and C++ are languages that are somewhat similar but do have their differences, and you're running into that. Either keep the code in C and link separate C++ code against it, or make sure all code complies to C++-standards.

dmitrij999
Posts: 71
Joined: Sat Mar 02, 2019 8:06 pm

Re: CPP: Invalid convertions and sorry-unimplemented's error while translating it from C

Postby dmitrij999 » Tue Apr 23, 2019 5:16 pm

I know about these problems, but I mean problems with structures


Who is online

Users browsing this forum: No registered users and 132 guests