Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Jennygrrl

macrumors newbie
Original poster
Feb 28, 2007
8
0
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);
}
 

HexMonkey

Administrator emeritus
Feb 5, 2004
2,240
504
New Zealand
You need to change the build configuration. Choose Project > Set Active Build Configuration > Release then rebuild and it should work. The Debug configuration allows you to debug but will only work on the computer it's built on.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.