I am new to itpp. I installed itpp under UBUNTU 12.04 using these commands:
apt-get install libitpp7
apt-get install libitpp7-dbg
apt-get install libitpp-dev
It seems to be OK when compiling, but when linking it shows error messages like this:
wtmf.o: In function read_smat_data(char*, itpp::Sparse_Mat<double>&)':
/home/npcfish/Desktop/code/wtmf.cpp:84: undefined reference toitpp::Sparse_Mat<double>::set_size(int, int, int)'
/home/npcfish/Desktop/code/wtmf.cpp:97: undefined reference to itpp::Sparse_Mat<double>::set(int, int, double)'
/home/npcfish/Desktop/code/wtmf.cpp:102: undefined reference toitpp::Sparse_Mat<double>::compact()'
/home/npcfish/Desktop/code/wtmf.cpp:106: undefined reference to `itpp::Sparse_Mat<double>::nnz()'
/home/npcfish/Desktop/code/wtmf.cpp:84: undefined reference to
itpp::Sparse_Mat<double>::set(int, int, double)'
/home/npcfish/Desktop/code/wtmf.cpp:102: undefined reference to
and so on. How can I solve this problem?
Thank you in advance~
it seems that you forgot to link with it++ library
So.. As I am really new to this, how should I do to make sure I am linking with it++ library? I tried "g++ wtmf.cpp $(pkg-config --libs itpp)" but it doesn't work...
run directly 'pkg-config --libs itpp' and check its output. Also have a look here
When I type this command:
% pkg-config --libs itpp
While when I try this command:
% itpp-config --libs
' -L/usr/local/lib -litpp'
I note there is a space before the second output?
That space should not be an issue. Please use directly in the command line:
g++ -L/usr/local/lib -litpp main.cpp -o main
and check the output
I tried, but it reports the same error messages...
It might be a problem with your IT++ library. Check that it is really inside /usr/local/lib folder. Also, you might try to build IT++ from sources using the version from master branch
It works now. It seems adding '$(pkg-config --libs itpp)' to the linking command would be OK. My mistake is I just forgot to link some of my code files that are used in my main cpp.
Thank you very much!