githwxi / ATS-Postiats

ATS2: Unleashing the Potentials of Types and Templates
www.ats-lang.org
Other
354 stars 54 forks source link

"implicit declaration of function" error at compilation #279

Open AkihiroSanada opened 2 months ago

AkihiroSanada commented 2 months ago

I tried to build ATS on MacOS, but build fails with implicit declaration of function error.

Error messages is as follows.

...
prelude/ats_main_prelude_dats.c: In function 'mainats_prelude':
prelude/ats_main_prelude_dats.c:72:1: error: implicit declaration of function 'ATS_2d0_2e2_2e12_2prelude_2DATS_2basics_2edats__dynload' [-Wimplicit-function-declaration]
   72 | ATS_2d0_2e2_2e12_2prelude_2DATS_2basics_2edats__dynload () ;
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prelude/ats_main_prelude_dats.c:73:1: error: implicit declaration of function 'ATS_2d0_2e2_2e12_2prelude_2DATS_2integer_2edats__dynload' [-Wimplicit-function-declaration]
   73 | ATS_2d0_2e2_2e12_2prelude_2DATS_2integer_2edats__dynload () ;
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prelude/ats_main_prelude_dats.c:74:1: error: implicit declaration of function 'ATS_2d0_2e2_2e12_2prelude_2DATS_2sizetype_2edats__dynload' [-Wimplicit-function-declaration]
   74 | ATS_2d0_2e2_2e12_2prelude_2DATS_2sizetype_2edats__dynload () ;
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prelude/ats_main_prelude_dats.c:75:1: error: implicit declaration of function 'ATS_2d0_2e2_2e12_2prelude_2DATS_2pointer_2edats__dynload' [-Wimplicit-function-declaration]
   75 | ATS_2d0_2e2_2e12_2prelude_2DATS_2pointer_2edats__dynload () ;
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prelude/ats_main_prelude_dats.c:76:1: error: implicit declaration of function 'ATS_2d0_2e2_2e12_2prelude_2DATS_2bool_2edats__dynload' [-Wimplicit-function-declaration]
   76 | ATS_2d0_2e2_2e12_2prelude_2DATS_2bool_2edats__dynload () ;
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prelude/ats_main_prelude_dats.c:77:1: error: implicit declaration of function 'ATS_2d0_2e2_2e12_2prelude_2DATS_2char_2edats__dynload' [-Wimplicit-function-declaration]
   77 | ATS_2d0_2e2_2e12_2prelude_2DATS_2char_2edats__dynload () ;
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prelude/ats_main_prelude_dats.c:78:1: error: implicit declaration of function 'ATS_2d0_2e2_2e12_2prelude_2DATS_2float_2edats__dynload' [-Wimplicit-function-declaration]
   78 | ATS_2d0_2e2_2e12_2prelude_2DATS_2float_2edats__dynload () ;
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prelude/ats_main_prelude_dats.c:79:1: error: implicit declaration of function 'ATS_2d0_2e2_2e12_2prelude_2DATS_2string_2edats__dynload' [-Wimplicit-function-declaration]
   79 | ATS_2d0_2e2_2e12_2prelude_2DATS_2string_2edats__dynload () ;
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prelude/ats_main_prelude_dats.c:80:1: error: implicit declaration of function 'ATS_2d0_2e2_2e12_2prelude_2DATS_2reference_2edats__dynload' [-Wimplicit-function-declaration]
   80 | ATS_2d0_2e2_2e12_2prelude_2DATS_2reference_2edats__dynload () ;
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prelude/ats_main_prelude_dats.c:81:1: error: implicit declaration of function 'ATS_2d0_2e2_2e12_2prelude_2DATS_2lazy_2edats__dynload' [-Wimplicit-function-declaration]
   81 | ATS_2d0_2e2_2e12_2prelude_2DATS_2lazy_2edats__dynload () ;
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prelude/ats_main_prelude_dats.c:82:1: error: implicit declaration of function 'ATS_2d0_2e2_2e12_2prelude_2DATS_2lazy_vt_2edats__dynload' [-Wimplicit-function-declaration]
   82 | ATS_2d0_2e2_2e12_2prelude_2DATS_2lazy_vt_2edats__dynload () ;
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prelude/ats_main_prelude_dats.c:83:1: error: implicit declaration of function 'ATS_2d0_2e2_2e12_2prelude_2DATS_2printf_2edats__dynload' [-Wimplicit-function-declaration]
   83 | ATS_2d0_2e2_2e12_2prelude_2DATS_2printf_2edats__dynload () ;
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prelude/ats_main_prelude_dats.c:84:1: error: implicit declaration of function 'ATS_2d0_2e2_2e12_2prelude_2DATS_2filebas_2edats__dynload' [-Wimplicit-function-declaration]
   84 | ATS_2d0_2e2_2e12_2prelude_2DATS_2filebas_2edats__dynload () ;
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prelude/ats_main_prelude_dats.c:85:1: error: implicit declaration of function 'ATS_2d0_2e2_2e12_2prelude_2DATS_2list_2edats__dynload' [-Wimplicit-function-declaration]
   85 | ATS_2d0_2e2_2e12_2prelude_2DATS_2list_2edats__dynload () ;
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prelude/ats_main_prelude_dats.c:86:1: error: implicit declaration of function 'ATS_2d0_2e2_2e12_2prelude_2DATS_2list_vt_2edats__dynload' [-Wimplicit-function-declaration]
   86 | ATS_2d0_2e2_2e12_2prelude_2DATS_2list_vt_2edats__dynload () ;
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc -I. -I./ccomp/runtime -c -o prelude_DATS_char_dats.o prelude/DATS_char_dats.c
prelude/ats_main_prelude_dats.c:87:1: error: implicit declaration of function 'ATS_2d0_2e2_2e12_2prelude_2DATS_2list0_2edats__dynload' [-Wimplicit-function-declaration]
   87 | ATS_2d0_2e2_2e12_2prelude_2DATS_2list0_2edats__dynload () ;
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prelude/ats_main_prelude_dats.c:88:1: error: implicit declaration of function 'ATS_2d0_2e2_2e12_2prelude_2DATS_2option_2edats__dynload' [-Wimplicit-function-declaration]
   88 | ATS_2d0_2e2_2e12_2prelude_2DATS_2option_2edats__dynload () ;
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc -I. -I./ccomp/runtime -c -o prelude_DATS_float_dats.o prelude/DATS_float_dats.c
prelude/ats_main_prelude_dats.c:89:1: error: implicit declaration of function 'ATS_2d0_2e2_2e12_2prelude_2DATS_2option_vt_2edats__dynload' [-Wimplicit-function-declaration]
   89 | ATS_2d0_2e2_2e12_2prelude_2DATS_2option_vt_2edats__dynload () ;
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prelude/ats_main_prelude_dats.c:90:1: error: implicit declaration of function 'ATS_2d0_2e2_2e12_2prelude_2DATS_2option0_2edats__dynload' [-Wimplicit-function-declaration]
   90 | ATS_2d0_2e2_2e12_2prelude_2DATS_2option0_2edats__dynload () ;
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prelude/ats_main_prelude_dats.c:91:1: error: implicit declaration of function 'ATS_2d0_2e2_2e12_2prelude_2DATS_2array_2edats__dynload' [-Wimplicit-function-declaration]
   91 | ATS_2d0_2e2_2e12_2prelude_2DATS_2array_2edats__dynload () ;
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prelude/ats_main_prelude_dats.c:92:1: error: implicit declaration of function 'ATS_2d0_2e2_2e12_2prelude_2DATS_2array0_2edats__dynload' [-Wimplicit-function-declaration]
   92 | ATS_2d0_2e2_2e12_2prelude_2DATS_2array0_2edats__dynload () ;
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prelude/ats_main_prelude_dats.c:93:1: error: implicit declaration of function 'ATS_2d0_2e2_2e12_2prelude_2DATS_2matrix_2edats__dynload' [-Wimplicit-function-declaration]
   93 | ATS_2d0_2e2_2e12_2prelude_2DATS_2matrix_2edats__dynload () ;
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prelude/ats_main_prelude_dats.c:94:1: error: implicit declaration of function 'ATS_2d0_2e2_2e12_2prelude_2DATS_2matrix0_2edats__dynload' [-Wimplicit-function-declaration]
   94 | ATS_2d0_2e2_2e12_2prelude_2DATS_2matrix0_2edats__dynload () ;
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prelude/ats_main_prelude_dats.c:95:1: error: implicit declaration of function 'ATS_2d0_2e2_2e12_2prelude_2DATS_2ptrarr_2edats__dynload' [-Wimplicit-function-declaration]
   95 | ATS_2d0_2e2_2e12_2prelude_2DATS_2ptrarr_2edats__dynload () ;
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[1]: *** [prelude_ats_main_prelude_dats.o] Error 1
...

On MacOS, -Werror=implicit-function-declaration is the default. This might cause the error above. I thought I can turn-off this option, but this is dangerous workaround although.

I'm newbie to ATS and not familiar to how the compiler works, but could anyone fix this?

githwxi commented 2 months ago

I thought I can turn-off this option, but this is dangerous workaround although.

It is not dangerous in this particular case. Please turn off the option.