Java文件能编译成lib吗_Makefile用于将一些.cpp和.h编译成lib

在构建dll时可以设置很多选项,但是如果您从命令行执行此操作,则可以使用这个基本命令:

gcc -shared -o mydll.dll file1.o file2.o file3.o

这是一个makefile(通常称为 Makefile ),它将处理整个构建过程:

# You will have to modify this line to list the actual files you use.

# You could set it to use all the "fileN" files that you have,

# but that's dangerous for a beginner.

FILES = file1 file2 file3

OBJECTS = $(addsuffix .o,$(FILES)) # This is "file1.o file2.o..."

# This is the rule it uses to assemble file1.o, file2.o... into mydll.dll

mydll.dll: $(OBJECTS)

gcc -shared $^ -o $@ # The whitespace at the beginning of this line is a TAB.

# This is the rule it uses to compile fileN.cpp and fileN.h into fileN.o

$(OBJECTS): %.o : %.cpp %.h

g++ -c $< -o $@ # Again, a TAB at the beginning.

现在要构建 mydll.dll ,只需输入"make"即可 .

几个笔记 . 如果只键入"make"而不指定makefile或目标(要构建的东西),Make将尝试使用默认的makefile("GNUMakefile","makefile"或"Makefile")和默认目标(makefile中的第一个,在这种情况下) mydll.dll ) .

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值