はじめに
タイトルの通り,超ニッチな問題です.
VSCodeで拡張機能「c/c++」をインストールし,Eigenライブラリをインクルードしたプログラムを開くと,以下のように赤線のエラーが出ます.
IntelliSenseがエラー部分を検出しているのですが,実際にコンパイルをすると問題なく通り,
実行することも可能です.
解決法
拡張機能「c/c++」のgithubのissue
で解決策が示されていました.
- 自分のプロジェクトのルートディレクトリで".vscode/eigen_fix.h"なるファイルを作成し,以下を記述します.
#if __INTELLISENSE__
#undef __ARM_NEON
#undef __ARM_NEON__
#endif
- 同じく,ルートディレクトリの".vscode/c_cpp_properties.json"で,以下の記述を追加します.
"forcedInclude": [
"${workspaceFolder}/.vscode/eigen_fix.h"
],
自分の場合は,".vscode/c_cpp_properties.json"全体を以下のような感じにすることで,赤波線が消え,正しく動くようになりました.
何が原因だったのか
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__マクロで呼び出すはずの関数を認識できないことによるエラーで,そのマクロをオフにすることで対処したということらしいです.