Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I fix the include_next of stdlib.h from cstdlib?

I'm building the Retargetable Decompiler (RetDec for short), and am coming across this error:

In file included from /usr/local/include/c++/8.2.0/ext/string_conversions.h:41,
                 from /usr/local/include/c++/8.2.0/bits/basic_string.h:6391,
                 from /usr/local/include/c++/8.2.0/string:52,
                 from /usr/local/include/c++/8.2.0/stdexcept:39,
                 from /usr/local/include/c++/8.2.0/array:39,
                 from /usr/local/include/c++/8.2.0/tuple:39,
                 from /usr/local/include/c++/8.2.0/bits/unique_ptr.h:37,
                 from /usr/local/include/c++/8.2.0/memory:80,
                 from /home/chronos/user/Downloads/git/retdec/build/external/src/yaramod-project/include/yaramod/builder/yara_expression_builder.h:9,
                 from /home/chronos/user/Downloads/git/retdec/build/external/src/yaramod-project/src/builder/yara_expression_builder.cpp:7:
/usr/local/include/c++/8.2.0/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
 #include_next <stdlib.h>
               ^~~~~~~~~~
compilation terminated.
make[5]: *** [src/CMakeFiles/yaramod.dir/build.make:74: src/CMakeFiles/yaramod.dir/builder/yara_expression_builder.cpp.o] Error 1
make[4]: *** [CMakeFiles/Makefile2:109: src/CMakeFiles/yaramod.dir/all] Error 2
make[3]: *** [Makefile:130: all] Error 2

I've dealt with this error before and have solved it, however I cannot remember how exactly I did it.

How do I fix this?

I've seen this question: Error compiling OpenCV, fatal error: stdlib.h: No such file or directory

The answers there do not help me.

like image 515
S.S. Anne Avatar asked Sep 16 '25 03:09

S.S. Anne


1 Answers

I tried to fix this issue, but wasted 5 hours. Finally, I manually replaced #include_next with #include in three files.

  • Replaced #include_next <stdlib.h> with #include <stdlib.h> in cstdlib and std_abs.h
  • Replaced #include_next <math.h> with #include <math.h> in cmath

I know this is not the real fix. But I had no other way.

Edit: In my case, these files were in C:\msys64\mingw64\include\c++\<version>\

like image 144
Sarsa Murmu Avatar answered Sep 17 '25 17:09

Sarsa Murmu