: 1.
: 关於(ii),把solver.o和helper.o弄成libsolver.a,不用把solver.h和helper.h一起
: 弄到libsolver.a里面吗??
不用, library is a collection of object files, so don't need to include header
files.
: 2.
: 在makefile里面,list of dependencies是只能放.o档吗?那.a档可以放吗?
Dependencies can be anything (files or even target/tokens in the makefile).
: 3.
: g++ 连结library archive一定要先用-L指定路径,再用-l指定lib档名吗?
: 如果操作在同一个目录下,可不可以直接写.a档在g++ -o main.o的後面?
Yes, you can do "g++ -o <execFile> main.o libsolver.a".
However, in this problem, I would like you to practice the "-l" and "-L"
options.
: -lz是指连接zlib的意思吗???
Yes.
: 4. 如果成功弄出执行档,要如何执行它呢?
Please see Post #2247
--
※ 编辑: ric2k1 来自: 140.112.21.241 (10/08 14:21)
1F:推 newmilktea:请问-L後面的路径如何才会连到HW1.1.P4 10/08 18:49
2F:推 anfranion:-L後面接当前目录(.)就好了 10/08 18:52
3F:→ newmilktea:不管我怎样打,它都一直去/usr/bin/ld找档案?!! 10/08 18:52
4F:推 newmilktea:g++ -o hw1.1.p4 main.o -L$./ -lsolver-lz 10/08 18:58
5F:→ newmilktea:是这样吗? 10/08 18:58
6F:→ ric2k1:不用 $ 10/08 19:45
7F:推 newmilktea:它还是出现/usr/bin/ld:cannot find -lsolver-lz?!! 10/08 19:59
8F:→ ric2k1:-lsolver-lz 不要黏在一起... 10/08 20:11
9F:推 newmilktea:喔喔!!谢谢教授! 10/08 20:16
10F:→ ric2k1:不客气! 可以推个 ID 对照表吗? (目前尚未过半...) 10/08 21:43