andmarti1424 / sc-im

sc-im - Spreadsheet Calculator Improvised -- An ncurses spreadsheet program for terminal
Other
4.77k stars 201 forks source link

Build Issue "note: include ‘<stdlib.h>’ or provide a declaration of ..." #872

Closed acbk2b closed 3 months ago

acbk2b commented 3 months ago

Hello all,

I am building sc-im 0.8.3-2 on Arch Linux. I have tried with the AUR package, but running make in the project as detailed in the README's installation instructions yields the same result. There are comments on the AUR comments page for the same error, thus I believe this may be a common issue. When I run make -C src, I get several errors related to ods.c, like the below:

formats/ods.c:97:28: error: implicit declaration of function ‘malloc’ [-Wimplicit-function-declaration]
   97 |         content = (char *) malloc(sb_content.size);
      |                            ^~~~~~
formats/ods.c:58:1: note: include ‘<stdlib.h>’ or provide a declaration of ‘malloc’
   57 | #include "../utils/string.h"
  +++ |+#include <stdlib.h>
   58 | #endif
formats/ods.c:97:28: warning: incompatible implicit declaration of built-in function ‘malloc’ [-Wbuiltin-declaration-mismatch]
   97 |         content = (char *) malloc(sb_content.size);
      |                            ^~~~~~
formats/ods.c:97:28: note: include ‘<stdlib.h>’ or provide a declaration of ‘malloc’

I also receive the same error for calls to atof. The fix for this issue was simply adding #include <stdlib.h> in src/formats/ods.c. I am not very familiar with C build systems, so I am not certain whether this has any other impacts. If this is an acceptable fix, I am more than happy to open a Pull Request for this, and if not I would appreciate some help in figuring out another solution.

Let me know if you need anything else from my end Thanks!

andmarti1424 commented 3 months ago

Yes please check pr 871.will merge it soon.

acbk2b commented 3 months ago

Awesome, I did not see that. Thanks for the update!