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 1 year has passed since last update.

M1チップを搭載したmacにインストールしたgccが,VSCodeのIntelliSenseでEigenを認識しない

Posted at

はじめに

タイトルの通り,超ニッチな問題です.
VSCodeで拡張機能「c/c++」をインストールし,Eigenライブラリをインクルードしたプログラムを開くと,以下のように赤線のエラーが出ます.

スクリーンショット 2023-04-26 17.51.34.png

IntelliSenseがエラー部分を検出しているのですが,実際にコンパイルをすると問題なく通り,
実行することも可能です.

解決法

拡張機能「c/c++」のgithubのissue
で解決策が示されていました.

  1. 自分のプロジェクトのルートディレクトリで".vscode/eigen_fix.h"なるファイルを作成し,以下を記述します.
.vscode/eigen_fix.h
#if __INTELLISENSE__
#undef __ARM_NEON
#undef __ARM_NEON__
#endif
  1. 同じく,ルートディレクトリの".vscode/c_cpp_properties.json"で,以下の記述を追加します.
.vscode/c_cpp_properties.json
"forcedInclude": [
    "${workspaceFolder}/.vscode/eigen_fix.h"
],

自分の場合は,".vscode/c_cpp_properties.json"全体を以下のような感じにすることで,赤波線が消え,正しく動くようになりました.
スクリーンショット 2023-04-26 18.01.50.png

何が原因だったのか

The problem appears that our IntelliSense parser does not recognize any of the intrinsic >types (and functions) found in the arm_neon.h header, so it causes a cascading amount of >errors for everything based on those types that don't exist.
I will file a feature request on our VS parser to add support for those.

詳しいことはよくわからないですが,IntelliSense内で,__ARM_NEON__マクロで呼び出すはずの関数を認識できないことによるエラーで,そのマクロをオフにすることで対処したということらしいです.

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?