Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Writing programs for a mac

  1. Aug 19, 2009 #1


    User Avatar
    Gold Member

    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.
  2. jcsd
  3. Aug 19, 2009 #2


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    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
  4. Aug 19, 2009 #3
    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.
  5. Aug 19, 2009 #4
  6. Aug 19, 2009 #5


    User Avatar
    Science Advisor

    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)

    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.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: Writing programs for a mac
  1. Self-writing program (Replies: 11)

  2. Writing a program in C (Replies: 8)