Xcode program won't run on any other mac besides mine

Discussion in 'Mac Programming' started by Jennygrrl, Mar 23, 2007.

  1. macrumors newbie

    Joined:
    Feb 28, 2007
    #1
    Hi everyone

    I wrote a C++ program and compiled it in xcode. It runs, but only on my Mac. I think this might be because i have the xcode tools installed but my other Mac doesnt (They are both Intel macs).

    Does anyone know how i can get my C++ program to work on another Mac without the dev tools? You can do this with Visual basic on Windows, so why not on a Mac?

    thanks!
    Jenny xx

    P.S. If this makes any difference, here is my code:
    Code:
    #include <stdio.h>
    
    int main()
    {
    	int num1, num2, num3;
    	int sum;
    
    	printf("Please enter the first number: ");
    	scanf("%d%*c", &num1);   
    
    	printf("Please enter the second number: ");
    	scanf("%d%*c", &num2);
    	
    	printf("Please enter the third number: ");
    	scanf("%d%*c", &num3);
    
    	sum = num1 + num2 + num3;
    	
    	printf("The sum of the three numbers is: %d\n", sum);
    
    	return(0);
    }
     
  2. macrumors 68040

    MongoTheGeek

    Joined:
    Sep 13, 2003
    Location:
    Its not so much where you are as when you are.
    #2
    Is it being compiled development or release?

    What error are you getting on the other systems?
     
  3. thread starter macrumors newbie

    Joined:
    Feb 28, 2007
    #3
    It is being compiled as release.

    When i open it up on another Mac, it just opens a blank Terminal window.
    I have tried this on multiple Macs both Intel and PPC
     
  4. macrumors 6502a

    Joined:
    Sep 3, 2005
    Location:
    Cramlington, UK
    #4
    Hi

    I was wondering how are you running your program? Have you tried running it from the command line in a terminal window?

    b e n
     
  5. thread starter macrumors newbie

    Joined:
    Feb 28, 2007
    #5
    Yes. I get Permission Denied on the 'other' Mac if i try that. And I get the same thing even if i type sudo. hmm :(
     
  6. macrumors member

    Joined:
    Feb 18, 2007
    Location:
    Eindhoven
    #6
    You can try running otool -L appname in a terminal to see if you have linked extra libs. I think otool comes with Xcode however. If it is a simple console app (no external libs used) it should just return /usr/lib/libSystem.B.dylib

    Wittegijt.
     
  7. macrumors 6502a

    Joined:
    Sep 3, 2005
    Location:
    Cramlington, UK
    #7
    Ah okay, it sounds like after copying it you've lost the execution bit in the file permissions or you only the owner has execute permission (even though you may have the same username on both machines you may have a different user id. Depending how you copied the file you may not end up owning the file on the other machine). If you do a ls -l on the file I think all will become apparent!

    Anyway, chmod a+x file-name should do the trick… perhaps using sudo if necessary.

    Hope this helps!

    b e n
     

Share This Page