我无法将MacPorts的/opt/local/include/ncurses.h导入到我的Swift项目中.它与macos SDK/usr/include/curses.h冲突.有什么提示吗? [英] I can't import MacPorts' /opt/local/include/ncurses.h into my Swift project. It conflicts with macos SDK /usr/include/ curses.h. Any hint?

查看:130
本文介绍了我无法将MacPorts的/opt/local/include/ncurses.h导入到我的Swift项目中.它与macos SDK/usr/include/curses.h冲突.有什么提示吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对这样一个详尽而诚实的问题是否定的看法?有时我并没有真正得到堆栈溢出.真的.

Getting negatives for such a detailed and HONEST question? Sometimes I don't really get Stack Overflow. Really.

我正在尝试使用Swift 5(Xcode 10.2.1)和现代ncurses格式(在这种情况下,是MacPorts的6.1.2018XXXX版本)创建PoC.

Hi, I'm trying to create a PoC using Swift 5 (Xcode 10.2.1) and a modern rendition of ncurses (in this case, MacPorts' one, some 6.1.2018XXXX version)

到目前为止,我的Poc还没有代码,因为在开始向.swift文件中添加任何有意义的行之前,我的问题开始了.

My Poc has no code as of now, as my problems start before being able to add any sensible line to my .swift files.

到目前为止,我已经完成了以下操作:

So far I've done the following things:

1.-我已经安装了可以正常工作的MacPorts ncurses库:这意味着"sudo port install htop"可以构建"htop"应用程序而没有任何问题,证明了我的ncurses库已正确安装(.h文件似乎部署在/opt/local/include/目录中

1.- I have a proper working MacPorts ncurses library installed: that means "sudo port install htop" can build "htop" application without any problem, proving that way that my ncurses library is correctly installed (.h files seem to be deployed inside /opt/local/include/ directory)

2.-我创建了一个空的CONSOLE APPLICATION swift程序(使用Xcode 10.2.1自己的向导).只需单击4次鼠标,您就会得到一些"Hello world"愚蠢的main.swift文件.

2.- I create an empty CONSOLE APPLICATION swift program (using Xcode 10.2.1 own wizard). It just takes 4 mouse clicks, and you get some "Hello world" silly main.swift file.

3.-我创建了一个桥接头文件来导入我的.h文件(在本例中为ncurses.h). 此桥接标头的内容将/应该是这样的:

3.- I create a bridging header to import my .h files (in this case ncurses.h). The contents of this bridging header will/should be something like this:

#import "/opt/local/include/ncurses.h"

4.-我编译并运行了一个愚蠢的空的"hello world"快速程序,并且遇到了很多预期"错误.就像是: "Darwin/SDK curses.h符号xxxxxxxxx也已在您的/opt/local/ncurses.h文件中定义.释放出来." (这不是我得到的字面上的错误,您只是了解这个想法)

4.- I compile and run the silly empty "hello world" swift program, and I get tons of somewhat "expected" errors. Something like: "Darwin/SDK curses.h symbol xxxxxxxxx is also defined inside your /opt/local/ncurses.h file. Bailing out." (it's not the literal error I get, you just get the idea)

所以我的问题是:

我可以在我的XCode项目定义中禁用/删除Darwin/internal/MacOs SDK curses.h,以便我的桥接头仅看到我的2(n)curses.h文件的一个副本(应该是我的macports文件夹). )?

Can I disable/remove Darwin/internal/MacOs SDK curses.h from my XCode project definition somewhere, in order my bridging header only sees one copy of my 2 (n)curses.h file (that should be my macports one)?

我已经尝试了另一个线程中描述的许多事情,但是没有运气:

I've tried many things described in this other thread, but with no luck: How to disable "curses.h" header (a part of "stdio.h in Xcode 6.3 OSX Yosemite) to avoid conflicting function declarations

特别是启用模块"选项,无论您将其设置为什么值,似乎都无济于事.

Specially "Enable Modules" option, which no matter the value you set it to, seems to do nothing.

顺便说一句:我知道什么时候可以解决此.h标头问题,我可能需要在Xcode的构建阶段"(?)选项卡中添加一些附加的-lib链接选项,但我将尝试管理自己当那一刻到来.

BTW: I know when I might solve this .h headers issue, I will probably need to add some additional -lib linking option in the "build phase"(?) tab inside Xcode, but I'll try to manage myself when that moment arrives.

到目前为止,我的关注点是我不会从Xcode项目中删除Apple Internal Macos SDK的curses支持/文件".这是可以实现的吗?

As of now my concern is "I wan't to remove Apple Internal Macos SDK curses support/files from my Xcode project". Is it achievable?

PS:我使用Mojave 10.4.4没问题

PS: I'm using Mojave 10.4.4 with no problem

推荐答案

我遇到了同样的问题,尽管尝试通过Swift Package Manager使用ncurses.尽管我一直在积极地寻求解决方案,但到目前为止,我一直没有成功.以防万一,请检查我的问题: Swift软件包管理器无法执行编译通过Homebrew安装的ncurses

I'm having the same issues, although trying to use ncurses via the Swift Package Manager. Despite being actively trying to find a solution I've been unsuccessful so far. Check my question just in case: Swift package manager unable to compile ncurses installed through Homebrew

这篇关于我无法将MacPorts的/opt/local/include/ncurses.h导入到我的Swift项目中.它与macos SDK/usr/include/curses.h冲突.有什么提示吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆