Eclipse IDE on Windows showing errors but complies fine...

lehrian
Posts: 21
Joined: Wed May 12, 2021 3:07 am

Eclipse IDE on Windows showing errors but complies fine...

Postby lehrian » Fri Aug 20, 2021 5:46 am

I am writing some code for a OneWire device and have it working fine in C. However I would like to change it to be a class in C++ and I have it compiling fine but Eclipse is showing errors that I can't make go away. Here is the IDE showing the function in a C file:
EclipseNoError.PNG
EclipseNoError.PNG (147.58 KiB) Viewed 7161 times
And here is the IDE showing the exact same code except it is now in a C++ method:
EclipseError.PNG
EclipseError.PNG (152.37 KiB) Viewed 7161 times
The error it shows when I hover over the first marker in the begin method is:
Problem description: Invalid arguments ' Candidates are: void gpio_pad_select_gpio(unsigned char) '
The error is shows when I hover of the second marker in the write method is:
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}) '
The rest of the error markers show very similar error descriptions. I had to cast

Code: Select all

(gpio_num_t)this->DS_GPIO
because the function is expecting an enum not an int and the cpp compiler, which is more picky about method signatures, threw an error. Once I cast it the code compiled just fine but Eclipse continues to complain about it. Any ideas why Eclipse would be complaining about the code in the C++ file but be completely fine with the same code in a C file?

lehrian
Posts: 21
Joined: Wed May 12, 2021 3:07 am

Re: Eclipse IDE on Windows showing errors but complies fine...

Postby lehrian » Sat Aug 21, 2021 7:32 pm

UPDATE: It seems that the inclusion of

Code: Select all

#include <freertos/FreeRTOS.h>
Is what is causing the issue. If I comment this include out the markers in Eclipse go away, but, because my code depends on this include, my code will not compile.

lehrian
Posts: 21
Joined: Wed May 12, 2021 3:07 am

Re: Eclipse IDE on Windows showing errors but complies fine...

Postby lehrian » Thu Oct 07, 2021 7:40 pm

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);
}

greycon
Posts: 33
Joined: Fri Nov 03, 2023 9:59 pm

Re: Eclipse IDE on Windows showing errors but complies fine...

Postby greycon » Sat Feb 17, 2024 5:34 pm

I cannot tell you how much I appreciate this post, and your workaround. (Moving the gpio include to the top) I have spent an entire afternoon wrestling with this issue, and I was getting pretty frustrated. If you ever find yourself in Ireland, I insist upon buying you a beer :-)

Who is online

Users browsing this forum: No registered users and 38 guests