1
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 5 years have passed since last update.

ビルド・エラー:"error: stray '\302' in program"について

Last updated at Posted at 2018-06-26

error: stray '\302' in program
error: stray '\240' in program
コード中に非ASCII文字が含まれていたため発生。

原因は無効な文字が含まれていたせいだった。
'\302'は全角スペースでいいのですが、
'\204'は分からなかったんですが何かの制御文字だったと思います。

その他、全角スペースへの対応について少し。

  • 可能ならエディタの設定で全角スペースを可視化する。

  • 全角スペースが含まれている場所を探す方法
    ソースファイルをgrep

find ./directry -type f | xargs grep " "
  • sed で全角スペースを半角スペースに置換する。
sed -i 's/ / /g' filepath

悩み、全角スペースに限らず、非ASCII文字を検索する方法はないのだろうか、、、

1
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
1
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?