2016-12-26 4 views
0

私は最近、Homebrewを使用してEigen(C++ライブラリ)をダウンロードし、EigenのWebサイトhttps://eigen.tuxfamily.org/dox/GettingStarted.htmlでサンプルプログラムをコンパイルしようとしました。g ++でコンパイルされていないMacのC++ライブラリmy_program.cpp -o my_program

私は、端末内のエラーを取得:

EigenExample1.cpp:10:10: fatal error: 'Eigen/Dense' file not found #include <Eigen/Dense> 

を私は二重の自作が更新されたとeigen3フォルダが/usr/local/includeに存在しないことを確認するチェックしました。

Apple LLVM version 8.0.0 (clang-800.0.42.1) 
Target: x86_64-apple-darwin16.3.0 
Thread model: posix 
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin 
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.12.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -E -disable-free -disable-llvm-verifier -discard-value-names -main-file-name - -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu penryn -target-linker-version 274.2 -v -dwarf-column-info -debugger-tuning=lldb -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0 -I /usr/include -fdebug-compilation-dir /Users/name/MNISTNeuralNetwork/Eigen -ferror-limit 19 -fmessage-length 80 -stack-protector 1 -fblocks -fobjc-runtime=macosx-10.12.0 -fencode-extended-block-signature -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -traditional-cpp -o - -x c - 
clang -cc1 version 8.0.0 (clang-800.0.42.1) default target x86_64-apple-darwin16.3.0 
ignoring duplicate directory "/usr/include" 
    as it is a non-system directory that duplicates a system directory 
\#include "..." search starts here: 
\#include <...> search starts here: 
/usr/local/include 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/include 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include 
/usr/include 
/System/Library/Frameworks (framework directory) 
/Library/Frameworks (framework directory) 
End of search list. 
+1

add -I -L固有のライブラリのフラグ – eyllanesc

答えて

2

あなたが自作を使用してインストールすると、Eigenディレクトリがinclude/eigen3の中にネストされています。また、私は、コマンドラインインストールツールとcpp -vリターンを持っています。あなたは以下のフラグを付けてコンパイルすることができるはずです:確かに

g++ -I "$(brew --prefix eigen)/include/eigen3" my_program.cpp -o my_program 

this is how the Homebrew installation is tested

関連する問題