Page 1 of 1

CPP file has problems with indexer...

Posted: Sun Oct 03, 2021 5:30 am
by lehrian
I am getting an error marker on code in a CPP file yet the same code in a C file does not generate the marker. In both cases the file compiles just fine. Here is a minimal example with the C file.
EclipseFunctionNoError.PNG
EclipseFunctionNoError.PNG (74.87 KiB) Viewed 4047 times
Here is the same code in a CPP file.
EclipseError.PNG
EclipseError.PNG (106.8 KiB) Viewed 4047 times
The error is
Problem description: Invalid arguments ' Candidates are: void
gpio_pad_select_gpio(unsigned char) '
and
Problem description: Invalid arguments ' Candidates are: int gpio_set_direction (enum {C:\Users\lehrian\Documents\esp- idf\components\hal\include\hal\gpio_types.h:7814}, enum {C: \Users\lehrian\Documents\esp-idf\components\hal\include\hal\gpio_types.h: 20385}) '

ESP-IDF product info:
Operating System: windows 10
Java Runtime Version: 15.0.1+9
Eclipse Version: 4.21.0.v20210906-0500
Eclipse CDT Version: 10.4.1.202109142059
IDF Eclipse Plugin Version: 2.2.0.202108110455
ESP-IDF v4.4-dev-3235-g3e370c429
Python set for IDF_PYTHON_ENV: Python 3.8.7
Python declared in PATH variable: Python 3.9.5

I ran the indexer using debug options as explained here https://www.eclipse.org/lists/cdt-dev/msg08941.html but it seems to be indexing the files correctly.
.
.
.
Indexer: adding file:/C:/Users/lehrian/Documents/esp-idf/components/freertos/port/xtensa/include/freertos/portmacro.h
Indexer: adding file:/C:/Users/lehrian/Documents/esp-idf/components/freertos/include/freertos/mpu_wrappers.h
Indexer: adding file:/C:/Users/lehrian/Documents/esp-idf/components/freertos/include/freertos/portable.h
Indexer: adding file:/C:/Users/lehrian/espressif/tools/xtensa-esp32-elf/esp-2021r1-8.4.0/xtensa-esp32-elf/lib/gcc/xtensa-esp32-elf/8.4.0/include/stddef.h
Indexer: adding file:/C:/Users/lehrian/espressif/tools/xtensa-esp32-elf/esp-2021r1-8.4.0/xtensa-esp32-elf/xtensa-esp32-elf/sys-include/reent.h
Indexer: adding file:/C:/Users/lehrian/Documents/esp-idf/components/freertos/include/freertos/FreeRTOS.h
Indexer: adding file:/C:/Users/lehrian/Documents/esp-idf/components/esp_hw_support/include/esp_intr_alloc.h
Indexer: adding file:/C:/Users/lehrian/Documents/esp-idf/components/esp_common/include/esp_types.h
Indexer: adding file:/C:/Users/lehrian/Documents/esp-idf/components/soc/esp32/include/soc/io_mux_reg.h
Indexer: adding file:/C:/Users/lehrian/Documents/esp-idf/components/soc/esp32/include/soc/gpio_struct.h
Indexer: adding file:/C:/Users/lehrian/Documents/esp-idf/components/soc/esp32/include/soc/gpio_reg.h
Indexer: adding file:/C:/Users/lehrian/Documents/esp-idf/components/soc/esp32/include/soc/gpio_sig_map.h
Indexer: adding file:/C:/Users/lehrian/Documents/esp-idf/components/soc/include/soc/gpio_periph.h
Indexer: adding file:/C:/Users/lehrian/Documents/esp-idf/components/hal/include/hal/gpio_types.h
Indexer: adding file:/C:/Users/lehrian/Documents/esp-idf/components/esp_rom/include/esp32/rom/gpio.h
Indexer: adding file:/C:/Users/lehrian/Documents/esp-idf/components/driver/include/driver/gpio.h
Indexer: adding file:/C:/Users/lehrian/Documents/ESP32/sample_project/main/TestClass.h
Indexer: adding file:/C:/Users/lehrian/Documents/ESP32/sample_project/main/TestClass.cpp
Indexer: processed \sample_project\main\TestClass.cpp [543 ms]
Indexer: parsing \sample_project\build\detect_compiler_builtins.cpp
[1,633,237,917,329] Parsed detect_compiler_builtins.cpp: 1 ms. Ambiguity resolution: 0 ms
Indexer: processed \sample_project\build\detect_compiler_builtins.cpp [1 ms]
Indexer: parsing \sample_project\build\bootloader\config\sdkconfig.h
[1,633,237,917,331] Parsed sdkconfig.h: 1 ms. Ambiguity resolution: 0 ms
Indexer: adding file:/C:/Users/lehrian/Documents/ESP32/sample_project/build/bootloader/config/sdkconfig.h
Indexer: processed \sample_project\build\bootloader\config\sdkconfig.h [2 ms]
C/C++ Indexer: Project 'sample_project' (7 sources, 253 headers)
Options: indexer='PDOMFastIndexer', parseAllFiles=true, unusedHeaders=useCPP, skipReferences=false, skipImplicitReferences=false, skipTypeReferences=false, skipMacroReferences=false.
Database: 4292608 bytes
Timings: 1239 total, 527 parser, 50 resolution, 379 index update.
Errors: 0 internal, 0 include, 0 scanner, 2 syntax errors.
Names: 7597 declarations, 10287 references, 0(0.00%) unresolved.
Cache[204MB]: 1673253 hits, 0(0.00%) misses.
Indexer: completed PDOMUpdateTask[1257ms]
Indexer: start PDOMFastIndexerTask
C/C++ Indexer: Project 'sample_project' (0 sources, 0 headers)
Options: indexer='PDOMFastIndexer', parseAllFiles=true, unusedHeaders=useCPP, skipReferences=false, skipImplicitReferences=false, skipTypeReferences=false, skipMacroReferences=false.
Database: 4292608 bytes
Timings: 1 total, 0 parser, 0 resolution, 0 index update.
Errors: 0 internal, 0 include, 0 scanner, 0 syntax errors.
Names: 0 declarations, 0 references, 0(0.00%) unresolved.
Cache[204MB]: 99 hits, 0(0.00%) misses.
Indexer: completed PDOMFastIndexerTask[3ms]
[1,633,237,917,976] Parsed TestClass.cpp: 14 ms. Ambiguity resolution: 0 ms
CModelBuilder2: parsing TestClass.cpp mode=skip all time=14ms
CModelBuilder2: building children=5 time=1ms
FIRING POST_CHANGE Delta [Thread[org.eclipse.cdt.internal.ui.text.CReconciler,1,main]]:
<NONE>
FIRING POST_RECONCILE Delta [Thread[org.eclipse.cdt.internal.ui.text.CReconciler,1,main]]:
TestClass.cpp WORKING_UNIT [?]: {FINE GRAINED}
Any ideas how to debug this or what is going on?

Re: CPP file has problems with indexer...

Posted: Wed Oct 06, 2021 9:17 pm
by lehrian
So I figured out a work around. It seems that if I move the import of gpio.h above FreeRTOS.h the error markers in Eclipse go away.

Code: Select all

#include <driver/gpio.h>
#include <freertos/FreeRTOS.h>
#include "TestClass.h"

TestClass::TestClass(uint8_t pin){
	this->gpio=pin;
}

void TestClass::testMethod(){
	gpio_pad_select_gpio((unsigned char)this->gpio);
}
Why does the order of import make a difference?