Page 1 of 1

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

Posted: Thu Jul 08, 2021 6:50 am
by mrdebug
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?

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

Posted: Thu Jul 08, 2021 1:34 pm
by ESP_igrr
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.