I'm using Dev C++, and I want to compile my program into a program usable on macs. Can I do this from Dev C++, or do I have to use a different program?

Recommended Answers

All 4 Replies

Yes you can do that and source code is portable as well, gcc is Mac main compiler. And use GTK :) there is also GTK for Mac. Of course it would not work on Mac, when you use Windows API. Once dev-c++ had a package system, which enabled to easily install GTK, but i didn't use it now for so long time. Installing GTK in Windows is unfortunately a bit tricky, as it involves extracting several libraries into the same directory tree.

Well, right now its just a text console program I want to give to my friend. Can you please tell me how to do this from Dev C++? Any help would be great, thanks!

It is certainly possible, but likely not that simple. Read the gcc manual http://gcc.gnu.org/onlinedocs/gcc-4.2.1/gcc You may try add to compiler options -b powerpc and -mcpu=powerpc, but most likely this would not be enough. Using gcc as a cross-compiler may iinvolve installing some additional files, and compiling gcc for being a cross-compiler for the target platform. Using cross-compiler is anyway not that simple, that you compile a binary and give it to a friend, you should most likely test it, in windows there is a powerpc emulator for that. So a realistic option, unless you have to do some serious cross-compiling, is still to compile it for your computer, and give the source code to a friend (a source distribution), maybe add the makefile, gcc is installed in every os x, and it is not difficult for your friend to compile your program.

Looks like I came to this thread a bit late, but I thought I'd throw in my 2 cents-worth.

First of all - don't even think about compiling anything until you've installed the Apple Developer Tools. There's a disc that comes with Mac OS X that contains this bundle of tools, but you can also download a more current version of it for free from Apple's website. Basically the set of tools contains Xcode, the primary IDE for software development on Macs, as well as command line utilities like gcc.

Once you have it installed, you have two options: use the command line, or use Xcode to build everything. I find Xcode faster to use for larger projects, so if you've got a number of source files, just add them into the Xcode project window and hit "Build and Run". Hopefully everything is self-explanatory. If you decide to use the command line, you'll want to use a makefile as has already been mentioned. Good luck!

[edit] It also depends on the Mac's architecture. Intels should have practically no problems running standard C++ code written in Windows, whereas you might have some endian-ness issues with the older PowerPC-based Macs.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.