AZO234 / NP2kai

Neko Project II kai
http://domisan.sakura.ne.jp/article/np2kai/np2kai.html
MIT License
246 stars 61 forks source link

[SDL2] Build error on Xcode12, so I have a few questions. #118

Open miyamoto999 opened 3 years ago

miyamoto999 commented 3 years ago

Xcode12でビルドエラーになったので直してみたんだけど、基本的に次のようなエラーが3カ所で出る。

sdl/dosio.c:360:16: error: implicit
      declaration of function 'rmdir' is invalid in C99
      [-Werror,-Wimplicit-function-declaration]
        return((short)rmdir(path));

コンパイルオプションに-Wno-implicit-function-declaration を付ければいいだけなんだけど、そもそもエラーにならないようにした方がいいだろうと思って直していったのだけど、よくわからないところがあったので質問。

#define _POSIX_C_SOURCE 199309L

この宣言が必要な理由は? これをなくすとエラーではなくなる。

以下、英文。今回も翻訳ツールの力を少し借りてしまった・・・


I fixed build errors on Xcode12, but basically the following errors appear in three places.

sdl/dosio.c:360:16: error: implicit
      declaration of function 'rmdir' is invalid in C99
      [-Werror,-Wimplicit-function-declaration]
        return((short)rmdir(path));

I just need to add -Wno-implicit-function-declaration to the compile options, but I thought it would be better to avoid errors, and I fixed it, but I didn't understand some things, so I asked a question.

#define _POSIX_C_SOURCE 199309L

Why is this declaration necessary? If this is removed, it won't show up in error.

AZO234 commented 3 years ago

いつもありがとうございます。 ご返事が遅れまして大変申し訳ございません。

define _POSIX_C_SOURCE 199309L

ビルドエラー回避?と思われますが、忘れました・・・。😥 libretroが「C99、C++99を目指そう」としているので、その意気込みを入れたのかも?

外して、再チェックしてみますね。

miyamoto999 commented 3 years ago

なるほど。 「意気込みを入れた」やmacOS以外のプラットフォームでのエラー回避なら、 macOSでは宣言されないようにする(今の状態)のが正解ですね😀

AZO234 commented 3 years ago

Apple系はLLVMで、gccとは異なるので、 規約通りの動きをしてくれない事が多いです。