error: conflicting declaration of 'int closedir(DIR*)

mrdebug
Posts: 43
Joined: Sat Jul 27, 2019 8:26 am

error: conflicting declaration of 'int closedir(DIR*)

Postby mrdebug » Thu Jul 08, 2021 6:50 am

Hi, after a eclipse software update the following lines of code:
main.cpp

Code: Select all

#include <stdio.h>
#include <sys/types.h>
#include <dirent.h>

extern "C" {
	void app_main(void);
}

void app_main(void)
{
    printf("Hello world!\n");

    DIR *Directory;
    opendir("");
    readdir(Directory);
    closedir(Directory);

}
causes the error

Code: Select all

error: conflicting declaration of 'int closedir(DIR*)' with 'C' linkage int  closedir(DIR *);
I have removed completely esp-idf and eclipse right now but the problem persists.
In the past I used the same functions without any problem.
Have you got a suggestion form me?

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: error: conflicting declaration of 'int closedir(DIR*)

Postby ESP_igrr » Thu Jul 08, 2021 1:34 pm

Hi mrdebug,
This is indeed a bug in ESP-IDF which has occured after the recent update of newlib (C library) version bundled with the toolchain.
We will fix this soon. You can "subscribe" to this issue: https://github.com/espressif/esp-idf/issues/7204 to get notified when the fix is merged. For now, the workaround suggested in that issue should work.

Who is online

Users browsing this forum: No registered users and 110 guests