我是makefile的新手; 所以,如果我的问题很简单,请接受我的道歉.
问题1:-L和-l选项有什么区别.
问题2:您如何提供某些图书馆的完整路径?例如,下面的makefile中提到的"libeng"和"libmx"位于{MATLABROOT}/bin/glnxa64
# root directory of MATLAB installation
MATLABROOT="/usr/local/MATLAB/R2011b"
all: engdemo
engdemo:
g++ ${MATLABROOT}/extern/examples/eng_mat/engdemo.cpp -o engdemo \
-I${MATLABROOT}/extern/include \
-L${MATLABROOT}/extern/lib -llibeng -llibmx
clean:
rm -f engdemo *.o
Run Code Online (Sandbox Code Playgroud)
更新:以下makefile工作原理:
# root directory of MATLAB installation
MATLABROOT="/usr/local/MATLAB/R2011b"
all: engdemo
engdemo:
g++ ${MATLABROOT}/extern/examples/eng_mat/engdemo.cpp -o engdemo \
-I${MATLABROOT}/extern/include \
#-L${MATLABROOT}/extern/lib -llibeng -llibmx
-L${MATLABROOT}/bin/glnxa64 -llibeng \
-L${MATLABROOT}/bin/glnxa64 -llibmx
clean:
rm -f engdemo *.o
Run Code Online (Sandbox Code Playgroud)
我发现以下关于链接库的链接非常有用:http: //www.cs.swarthmore.edu/~newhall/unixhelp/howto_C_libraries.html
| 归档时间: |
|
| 查看次数: |
10280 次 |
| 最近记录: |