简体   繁体   English

在Mac OS Lion上使用pkg-config在Include目录中使用反斜杠

[英]Backslash on Include directories with pkg-config on Mac OS Lion

Good evening everybody, 晚上好大家,

I have virtually no experience with pkg-config but it seems that I will have to use it in working with openssl. 我几乎没有pkg-config的经验,但似乎在与openssl一起使用时必须使用它。 Im on a Mac, which might be of some importance. 我在Mac上,这可能有些重要。

The problem is: 问题是:

  • i compile my testing program with 我用编译我的测试程序

     cc test.cc `pkg-config --libs --cflags openssl` -o test 
  • i have compiled openssl and installed it in ~/openssl afterwards adding ~/openssl/lib/pkgconfig to the PKG_CONFIG_PATH 我已经编译了openssl并将其安装在〜/ openssl中,然后将〜/ openssl / lib / pkgconfig添加到PKG_CONFIG_PATH中
  • since I want to use the newest version instead of the preinstalled one, I specify the options with every compilation 由于我想使用最新版本而不是预装版本,因此我在每次编译时都指定了选项
  • the result of running pkg-config --libs or pkg-config --cflags openssl is -L\\~/openssl/lib -lssl -lcrypto 运行pkg-config --libspkg-config --cflags openssl-L\\~/openssl/lib -lssl -lcrypto

This begs the question for me why there is a backsash and whether my compiled version is used or the preinstalled one and if the first one is the case how i could possibly fix this... 这为我提出了一个问题,为什么会有一个后退窗口,是否使用了我的编译版本或预装的版本,如果是第一个,我该如何解决呢?

Any kind of help is appreciated 任何帮助都值得赞赏

The expansion of ~ to your home directory only occurs in certain circumstances. ~扩展到您的主目录仅在某些情况下发生。 Basically, it's the shell that's doing it. 基本上,这就是外壳程序。 If a program or a file API sees the tilde, it is interpreted as a literal; 如果程序或文件API看到波浪号,则将其解释为文字。 it's not expanded. 它没有扩展。

Use $HOME when setting PKG_CONFIG_PATH instead, as in $HOME/openssl . $HOME/openssl一样,在设置PKG_CONFIG_PATH时使用$HOME

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM