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 ) .
總結
以上是生活随笔為你收集整理的Java文件能编译成lib吗_Makefile用于将一些.cpp和.h编译成lib的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java中删除node节点_[Java]
- 下一篇: 字节码是java虚拟机的指令组_JVM?