0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

BluePill で invalid conversion を fpermissive で回避

Posted at

多分一部のライブラリがver upしたからと思いますが、以前通ったはずのサンプルコードが今日は通らない。

コンパイラのメッセージを見ると
invalid conversion from 'const uint8_t* {aka const unsigned char*}' to 'uint8* {aka unsigned char*}' [-fpermissive]
 と出ている。
うーん、細けぇこというなよ、、と思いつつ、ネットを調べると、コンパイラのオプションは
C:\Program Files (x86)\Arduino\hardware
下にあるそれぞれのハードウェアの、つまり例えばnanoなら
C:\Program Files (x86)\Arduino\hardware\arduino\avr
にある platform.txt
に記述されているとのこと。 nanoではエラーにならないので、こっちを見てみると
compiler.cpp.flags=-c -g -Os {compiler.warning_flags} -std=gnu++11 -fpermissive 以降略
と -fpermissive が指定されている。

一方 
C:\Program Files (x86)\Arduino\hardware\Arduino_STM32-master\STM32F1
にある BluePill 用のそれには
compiler.cpp.flags の項に -fpermissive が指定されていないので追記してみたところ
問題無くコンパイルされ期待通りの動きをしてくれました。

自分向け備忘録的ではありますが、
エラーメッセージがでると、従来はめげてしまっていましたが、今回は読解して対処してみた結果うまくいったので、他にもはまる人いるのかも、、ということで書いておきまする。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?