在mac osx上使用gnu / c getline()编译c ++代码? [英] compiling c++ code using gnu/c getline() on mac osx?
问题描述
我想在我的mac osx豹机器上编译一个预先存在的c ++包,并得到以下错误:
错误:没有匹配函数调用'getline(char **,size_t *,FILE *&)'
这可能是因为getline ()是一个GNU特定的扩展。
我能以某种方式使osx默认的g ++编译器识别这种GNU特定的扩展吗?
(如果不是,我可以随时提供我自己的实现或GNU原始版本,但如果可能,我更喜欢使用更干净的解决方案)。 $ b
stdio.h中定义
在glibc 2.10及更高版本中,但不在早期版本中,也没有(到目前为止; 添加了 10.5绝对没有 getline
, 10.7)在BSD派生的libc中。 GNU库中的变化是由于POSIX 2008标准的变化引起的,它现在包括 getline
。
据推测,这会随着时间的推移传播给其他libc。同时,我明白这对许多项目造成了麻烦。
您可以下载独立版本的GNU 。
I'm trying to compile a pre-existing c++ package on my mac osx leopard machine, and get the following error:
error: no matching function for call to 'getline(char**, size_t*, FILE*&)'
This is probably because getline() is a GNU specific extension.
Can I somehow make the osx default g++ compiler recognize such GNU specific extensions?
(if not, I could always supply my own implementation or GNUs original one, but I prefer to have a "cleaner" solution if possible)
getline
is defined in stdio.h
in glibc version 2.10 and later, but not in earlier versions, nor (so far; added 10.5 definitely didn't have getline
, and 10.7 definitely does) in the BSD derived libc.
The change in the GNU libraries came about because of a change in the POSIX 2008 standard, which now includes getline
.
Presumably, this will propogate to other libc over time. In the mean time, I understand that it is causing trouble for a lot of projects.
You can download a stand alone version from GNU.
这篇关于在mac osx上使用gnu / c getline()编译c ++代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!