2015-07-11 95 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