我正在尝试在命令行工具中运行以下代码:
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[])
{
@autoreleasepool {
// insert code here...
NSLog(@"Hello, World!");
}
return 0;
}
在“构建成功”之后,我收到以下错误:
错误:无法启动“/Users/dimitrisagagiotis/Library/Developer/Xcode/DerivedData/test-guvgymeaqzlsheascqbmllxdtpsn/Build/Products/Debug/test”——无效的主机字符串:“localhost”
有什么解决办法吗???谢谢
我遇到了同样的问题并通过以下步骤解决了它。
- 您必须验证以下行是否包含在
/etc/hosts
file
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
- Execute
dscacheutil -flushcache
重新加载 DNS 配置
我完全不知道如何在没有本地主机环回 DNS 条目的情况下获取主机文件。从这个角度来看,“无效的主机字符串:'localhost'”非常自我描述:localhost 对于系统来说是无效的主机字符串,它根本无法解析 localhost。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)