2015-07-11 105 views
0

我的cpp文件有ScilabOctave頭文件。我想使用此命令C++編譯錯誤 - undefined參考

g++ -l:/usr/lib/scilab/libscilab.so -L/usr/lib/scilab -L/usr/lib/scilab -I/usr/include/octave-3.8.1 -I/usr/include/octave-3.8.1/octave -I/usr/include/scilab s_o_test_v4.cpp -o s_o_test_v4 

我收到以下錯誤

s_o_test_v4.cpp:(.text+0x5f4): undefined reference to `pvApiCtx' 
s_o_test_v4.cpp:(.text+0x5ff): undefined reference to `isVarMatrixType' 
s_o_test_v4.cpp:(.text+0x61a): undefined reference to `pvApiCtx' 
s_o_test_v4.cpp:(.text+0x644): undefined reference to `getMatrixOfDouble' 
s_o_test_v4.cpp:(.text+0x743): undefined reference to `string_vector::c_str_vec() const' 
s_o_test_v4.cpp:(.text+0x755): undefined reference to `octave_main' 
s_o_test_v4.cpp:(.text+0x7a2): undefined reference to `octave_value::octave_value(double)' 
s_o_test_v4.cpp:(.text+0x847): undefined reference to `feval(std::string const&, octave_value_list const&, int)' 
s_o_test_v4.cpp:(.text+0x8a3): undefined reference to `pvApiCtx' 

雙方的Scilab和倍頻功能顯示錯誤編譯。我是否應該在編譯命令中包含或刪除某些內容?

回答

0

也許你make命令的順序是錯的,也 this SO question看到:

也請注意,庫需要在命令 行中指定文件後需要他們

這將使你的命令:

g++ -I/usr/include/octave-3.8.1 -I/usr/include/octave-3.8.1/octave -I/usr/include/scilab s_o_test_v4.cpp -o s_o_test_v4 -l:/usr/lib/scilab/libscilab.so -L/usr/lib/scilab -L/usr/lib/scilab