Can Xcode be used to compile C++ programs for a Mac from a Linux system?

  • Context: C/C++ 
  • Thread starter Thread starter daniel_i_l
  • Start date Start date
  • Tags Tags
    Mac Programs Writing
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
4 replies · 3K views
daniel_i_l
Gold Member
Messages
864
Reaction score
0
I use linux on a pc and one of my friends who uses a mac wants me to write a small app for him. It doesn't need any GUI of anything, just a few lines in C++ with a bitmap image for input and an output to a text file.
Is there a way for me to compile it in linux so that he'll be able to use it with his mac? He isn't very computer literate so I don't want him to have to do a lot of tweaking.
Thanks.
 
Physics news on Phys.org
In general, you cannot compile it on a Linux machine and then run it on a Mac. The Mac should already have the GNU compiler collection installed on it, though, so you should be able to compile it on the Mac with the same commands you would use on the Linux box.

- Warren
 
If you compile using gcc on the linux box, should it not work on unix since the two are similar?

I remember running a small program on Solaris that was compiled in ubuntu.
 
XCode is Apple's Development Suite (free through Apple Developer, and I think it's still included--but not installed--on the OS X DVD, up to Leopard, OS X 10.5)
http://en.wikipedia.org/wiki/Xcode
http://developer.apple.com/TOOLS/xcode/

I think (but am not positive) that it includes GCC, and a whole lot of other things. However, it should be able to compile your (very basic, and non-system specific) C++ code to at least a terminal program. Barring that, there're Widgets like QT, wxWidgets, and GTK+ which would allow you to develop cross-platform (to a point) GUI programs.