Cant build any programs. Error --invalid host string 'localhost'

Discussion in 'Mac Programming' started by teamrusnac, Jun 8, 2012.

  1. teamrusnac, Jun 8, 2012
    Last edited by a moderator: Jun 9, 2012

    macrumors newbie

    Joined:
    May 19, 2012
    Location:
    Or-Gone
    #1
    I am trying to run in command line tool the following code:


    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:


    error: failed to launch '/Users/rrusnac/Library/Developer/Xcode/DerivedData/5.1_Practice-gdhkgzautnruix bnobucittithbz/Build/Products/Debug/5.1 Practice ' --invalid host string: 'localhost'


    It doesnt matter what code I enter, I get the same error. I cant figure out for the life of me why this is happening. I am running Xcode 4.3.2 and Lion 10.7.4.


    The programs build and run with no Issues, but this error always pops up. Please help me!
     
  2. macrumors 6502a

    FenrisMoonlight

    Joined:
    Jun 25, 2012
    Location:
    Los Angeles
    #2
    Check your /etc/hosts file and make sure it contains an entry for localhost. Default /etc/hosts should have the following entries

    Code:
    127.0.0.1       localhost
    255.255.255.255 broadcasthost
    ::1             localhost 
    fe80::1%lo0     localhost
    
     
  3. macrumors 68000

    Littleodie914

    Joined:
    Jun 9, 2004
    Location:
    Rochester, NY
  4. macrumors newbie

    Joined:
    Jul 17, 2014

Share This Page