【问题标题】:GNU MAKE - create getoptpp library from my own Makefile or suggest command line options library for c++GNU MAKE - 从我自己的 Makefile 创建 getoptpp 库或为 c++ 建议命令行选项库
【发布时间】:2012-04-15 10:19:36
【问题描述】:

描述如何从我自己的 GNU Makefile 将“getoptpp”编译为阴影库并将其静态链接到我的程序?

我的工作:

在我的程序目录中,我将 getoptpp 库解压缩到具有相同名称的子目录中。 比向我的 Makefile 添加新目标:(自述文件说我使用 SHARED 标志来制作。$> make SHARED=n)

getoptpp:
     cd getoptpp; $(MAKE) SHARED=n 

比我将此目标添加到我的程序的请求目标列表中:

 myprogram: getoptpp
     g++ **** myprogram

但在调用 make myprogram 之后 - 根本没有创建新的 .so。 调用“make getoptpp”时 - make 说“是最新的”

*添加:.PHONY 建议后出现错误 *

cd getoptpp; make SHARED=n
"Makefile", line 15: Missing dependency operator
"Makefile", line 19: Need an operator
"Makefile", line 24: Need an operator
"Makefile", line 45: Missing dependency operator
"Makefile", line 47: Need an operator
make: fatal errors encountered -- cannot continue
*** Error code 1

http://code.google.com/p/getoptpp/

请为我的 c++ 程序推荐非常好的命令行解析库。我可以简单地编译为链接到我的程序的 .o 对象。没有提升!

【问题讨论】:

    标签: c++ command-line makefile gnu


    【解决方案1】:

    目录存在且未更新,所以是的,它是最新的。也许你想declare it as a dependency of .PHONY

    【讨论】:

    • 谢谢,现在出现错误。派对 makefile 来自盒子。
    • 这是什么系统?看起来您的 make 不是 GNU make;您可能需要调用 gmake,尤其是在 *BSD 主机上。
    • 是的,现在我在 freebsd。谢谢,但是...如果我将在这种库的这种编译中使用 gmake,我的 makefile 将不能移植到其他 *unix 系统? :( 不合适((
    • 您不需要将它用于您的 Makefile,但您必须使用它来制作 getoptpp
    猜你喜欢
    • 1970-01-01
    • 2013-12-16
    • 1970-01-01
    • 1970-01-01
    • 2013-11-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多