in my homework i must use this command to compile my program:
gcc -o mtm_rentals -std=c99 -Wall -pedantic-errors -Werror -DNDEBUG mtm_ex2.c rentals.c list.c -L -lmtm
what i can change in that line are the files im writing after -DNDEBUG. when i do this the gcc says that there are undefined references to specific functions. now those functions are declared in an .h file and are implemented in a given file called libmtm.a i concluded that it doesnt recognize libmtm.a, but our homework task says that the -lmtm flag(which is not开发者_运维知识库 declared anywhere) is supposed to link libmtm.a to the program.
what am i missing here? am i supposed to implement somehow the -lmtm flag? thank you!
You are missing a .
(single dot) behind the -L
.
-lmtm
will link against a libmtm
library, this is correct. It's not an -lmtm
flag, it's a -l
flag concatenated with mtm
, the library you want to link against. This library is searched in some predefined paths (like /usr/lib/
) and additionally in the paths given by -L. Assuming libmtm
lives in your current directory, you need to add that to -L
, which is done with a .
.
精彩评论