I am new to makefile stuff; so, please accept my apology if my questions are trivials.
Question 1: What is the difference between -L and -l option.
Question 2: How do you provide complete path to some library? For instance, "libeng" and "libmx", mentioned in following makefile,are located at {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
Update:
Following makefile works:
# 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
I found following link about linking libraries very useful:
http://www.cs.swarthmore.edu/~newhall/unixhelp/howto_C_libraries.html
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…