bitluni / ESP32CameraI2S

176 stars 61 forks source link

Correct return type of I2SCamera::dmaBufferInit #1

Closed per1234 closed 6 years ago

per1234 commented 6 years ago

Lack of return statement in this function was causing compilation to fail:

C:\Users\per\AppData\Local\Temp\arduino_build_111040\sketch\I2SCamera.cpp: In static member function 'static bool I2SCamera::dmaBufferInit(int)':
I2SCamera.cpp:215: error: no return statement in function returning non-void [-Werror=return-type]

 }
 ^

cc1plus.exe: some warnings being treated as errors
bitluni commented 6 years ago

thanks! oddly, my compile passed.. probably just as warning

per1234 commented 6 years ago

It was surprising to me also as I would expect that to only cause a warning. I just looked into it and it turns out that the way the ESP32 core for Arduino is set up, when you have File > Preferences > Compiler warnings: set to "More" or "All" it also passes the -Werror=all compiler flag. With compiler warnings set to "All" (which is actually -Wall -Wextra) the lack of a return statement in a non-void function causes a warning and -Werror=all turns that warning into an error. So this error would only occur with that specific configuration of the Arduino IDE but I think it's not too uncommon for people to have their compiler warnings set to "All".