マトリックスライブラリを使用している.cppファイルをコンパイルしようとしています。ライブラリファイルlibnewmat.aとlibnewmat.soはパス/ usr/lib64にあります。インクルードファイルは、パス/ usr /含める/ newmatであるので、私は、すなわちをコンパイルする(いくつかの方法を)試してみました:g ++でライブラリをリンクできない
g++ -I/usr/include -L/usr/lib64 -lnewmat new.cpp -o new3
コンパイラは、ライブラリを見つけることができません。 .cppファイルの内容は次のとおりです。
#include <iostream>
#include <newmat/newmat.h>
#include <newmat/newmatio.h>
using namespace std;
int main()
{
Matrix A(2,2);
Real b[] = {1,2,3,4};
A << b;
cout << A << endl;
return 0;
}
コンパイラは言う:
test.cpp: In function ‘int main()’:
test.cpp:9: error: ‘Matrix’ was not declared in this scope
test.cpp:9: error: expected ‘;’ before ‘A’
test.cpp:10: error: ‘Real’ was not declared in this scope
test.cpp:10: error: expected ‘;’ before ‘b’
test.cpp:11: error: ‘A’ was not declared in this scope
test.cpp:11: error: ‘b’ was not declared in
この範囲
あなたは正しいC++コード、または正しいコマンドライン命令を私に提供することができますか?
おかげで、あなたは最近、あなたはおそらく、リンカ・キャッシュにロードするためにこれをsudo ldconfig
を実行する必要があり、このライブラリを自分でインストールした場合はケプラー
は、私は名前空間のNEWMATを使用して を忘れてしまった 、ありがとうございました。 つまり、成功する前にこのライブラリを実行したOpenSuseのNetbeansでは、この名前空間を使用する必要はありませんでした。 大変ありがとうございます。 :-) ケプラー – Kepler