Xcode错误:无法启动[目录]-无效的主机字符串:'localhost' [英] Xcode error: failed to launch [directory] -- invalid host string: 'localhost'

查看:82
本文介绍了Xcode错误:无法启动[目录]-无效的主机字符串:'localhost'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在命令行工具中运行以下代码:

I am trying to run in command line tool the following code:

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[])
{

    @autoreleasepool {

       // insert code here...
    NSLog(@"Hello, World!");

}
return 0;
}

在构建成功"之后,出现以下错误:

and after "Build Succeeded" I am getting the following error:

错误:无法启动'/Users/dimitrisagagiotis/Library/Developer/Xcode/DerivedData/test-guvgymeaqzlsheascqbmllxdtpsn/Build/Products/Debug/test'-无效的主机字符串:'localhost'

error: failed to launch '/Users/dimitrisagagiotis/Library/Developer/Xcode/DerivedData/test-guvgymeaqzlsheascqbmllxdtpsn/Build/Products/Debug/test' -- invalid host string: 'localhost'

任何解决方案???谢谢

any solution??? Thank you

推荐答案

我遇到了同样的问题,并通过以下步骤解决了该问题.

I had the same issue and resolved it with the following steps.

  • 您必须验证/etc/hosts文件中是否包含以下行
  • You have to verify that the following lines are included in the /etc/hosts file
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost 
fe80::1%lo0     localhost

  • 执行dscacheutil -flushcache重新加载DNS配置
    • Execute dscacheutil -flushcache to reload the DNS configuration
    • 我绝对不知道在没有将DNS环回DNS条目到本地主机的情况下如何获得主机文件.从这个角度来看,无效的主机字符串:'localhost'" 很容易描述:本地主机对于系统是无效的主机字符串,它根本无法解析本地主机.

      I have absolutely no idea how it was possible to get a host file without the loopback DNS entries to localhost. From this point of view, "invalid host string: 'localhost'" is pretty self-describing: localhost is a invalid host string to the system, it simply can not resolve localhost.

      这篇关于Xcode错误:无法启动[目录]-无效的主机字符串:'localhost'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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