c++ - 将 Xcode 项目与 MathGL 链接时的语义问题

标签 c++ xcode mathgl

我需要使用 MathGL ( mathgl.sourceforge.net ) 在我的 Objective-C 项目中绘制图形,但由于文件 datac_cf.h 和 canvas_cf.h 中的语义问题,我无法编译它,例如:

/usr/local/include/mgl2/datac_cf.h:80:17: 'mgl_datac_get_value' has C-linkage specified, but returns user-defined type 'dual' (aka 'complex<mreal>') which is incompatible with C

/usr/local/include/mgl2/datac_cf.h:206:17: 'mgl_datac_linear' has C-linkage specified, but returns user-defined type 'dual' (aka 'complex<mreal>') which is incompatible with C

/usr/local/include/mgl2/canvas_cf.h:494:17: 'mgl_cexpr_eval' has C-linkage specified, but returns user-defined type 'dual' (aka 'complex<mreal>') which is incompatible with C

每次在“双 MGL_EXPORT ...”行上都有 7 个

我使用 cmake 成功编译了 MathGL,并将 Xcode 项目头搜索路径配置为“/usr/local/include”,将库搜索路径配置为“/usr/local/lib”,我还拖放了 libmgl.7.0.0 .dylib 到我的项目..

请问我怎样才能摆脱这些语义问题?

最佳答案

我正在使用 FreeBSD 并且遇到了类似的问题。消除这些警告的最简单方法是使用 -Wno-return-type 或更具体地说,使用 -Wno-return-type-c-linkage 标志,它会抑制这些警告。

除此之外,您可以修补 header 。

关于c++ - 将 Xcode 项目与 MathGL 链接时的语义问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19199785/

相关文章:

c++ - MathGL BoxPlot 的数据格式

c++ - isalpha(<mychar>) == true 计算结果为 false?

c++ - 类型名称后的括号是否与 new 有所不同?

python - 将元素从一个出队移动到另一个时,C++ 使用两倍的内存

ios - Xcode 显示内存泄漏,但 Instruments 没有

c++ - 编译第一个 mathgl 示例错误

c++ - 如何使用 MathGL 在屏幕上显示图形

c++ - 打印 n 级调用堆栈?

xcode - 在启动时决定 Storyboard

iphone - 设计时特定于 iphone 4 的 Storyboard