free c++ compiler for mac not using xcode - c++

Are there any free c++ compilers for macs that do not need xcode?

If you install the Developer Tools (which include Xcode), you get GCC installed as well. You can use it from the command line.
gcc -o myprogram main.cpp

If you have very small needs, you might be able to use a an online IDE like compilr (http://www.compilr.com) or codepad (http://www.codepad.org).

download the latest iPhone SDK from developer.apple.com
it includes the XCode and GCC tool chain for both Mac and iPhone development.
you won't need any iPhone developer license if you are developing for Mac.

Just install xcode, then inside xcode install command line tools. You wont need xcode from that point on (although i really recommend it).
I hope i helped :)

Related

How to install Eclipse for C++ for OS X Yosemite?

I have a macbook and i'm studying C++ myself. I cant practice it because i don't know how to get eclipse working. Can someone show me exact steps to install eclipse on mac(preferred pictures with notes). Thanks
Download Eclipse CDT, unzip it, then "double click" on the "Eclipse" icon in the unzipped folder. This should do it. If you want the debugger to work, that's a different story, you have to use g++ with gdb (Eclipse doesn't work with lldb), so you need to install g++ and gdb and code-sign the latter. Easiest way to install them is via macports.
PS: to get Eclipse working you need a Java virtual machine, see here how to install it for Yosemite.
BTW: check out the CLion IDE from JetBrains, I find it quite nice. Or, if you want to stick to clang++ use XCode. The only downside in that case is the IDE (I'm not super excited about XCode) and clang++'s lack of OpenMP (which for me was extremely important). You can make OpenMP work with clang++, but it is a pain.

How do I need to configure Eclipse to create a C++ program?

I installed Eclipse for C/C++ Developers.
After installing it I also installed PyDev.
I managed to create a C++ project (The Hello World project that comes with it). But I cannot compile/run it.
When I created the project there was nothing in the toolchain list. So I think I will need to install a toolchain. But I cannot find anything. I need someone to help me with this please.
I am using 64 bit Windows 7.
No compiler, no executable.
Check MinGW
This is one of the first results i got in google for eclipse and mingw:
http://max.berger.name/howto/cdt/cdt.jsp
You need to install not only Eclipse CDT, but also a C/C++ compiler for Windows, like minGW.
Try installing TDM-GCC from http://tdm-gcc.tdragon.net/ . This should have you up and going with a compatible GCC setup under Windows in a snap.

Making Eclipse for C++ developers compile

I've downloaded Eclipse for C/C++ for Mac OSX. I'm running Snow Leopard. Now, when trying to run the Hello World application on Eclipse, it is complaining that
What might be the issue? Maybe I don't have (or Eclipse can't find) where my C++ compiler is? If that is the issue, what should I install and how should I proceed so that Eclipse recognizes it?
It looks like gcc is not in your path. Try adding the path to gcc (should be in /usr/bin by default) to your PATH environment variable and relaunch Eclipse.
You can also try adding it to Eclipse's preferences. I believe you'll find an item in the eclipse preferences which will allow you to point eclipse at the location of gcc. This would come in handier then benw's answer in my opinion because you're not changing anything with the system itself. Developing often involves setting things up specific to your development environment. Although it seems like gcc would be on your PATH already if it were installed. Have you installed Apple's developer tools by any chance?
Thanks.
Since I cannot comment on that comment you just put above. Install the Apple Developer tools. You can go here to download them. I just used gcc on my work mac today, and I never installed gcc specifically so it had to have been installed when I installed the developer tools.

How do I install g++ on MacOS X?

I want to compile C++ code on MacOS X, using the g++ compiler. How do I install it?
That's the compiler that comes with Apple's XCode tools package. They've hacked on it a little, but basically it's just g++.
You can download XCode for free (well, mostly, you do have to sign up to become an ADC member, but that's free too) here: http://developer.apple.com/technology/xcode.html
Edit 2013-01-25: This answer was correct in 2010. It needs an update.
While XCode tools still has a command-line C++ compiler, In recent versions of OS X (I think 10.7 and later) have switched to clang/llvm (mostly because Apple wants all the benefits of Open Source without having to contribute back and clang is BSD licensed). Secondly, I think all you have to do to install XCode is to download it from the App store. I'm pretty sure it's free there.
So, in order to get g++ you'll have to use something like homebrew (seemingly the current way to install Open Source software on the Mac (though homebrew has a lot of caveats surrounding installing gcc using it)), fink (basically Debian's apt system for OS X/Darwin), or MacPorts (Basically, OpenBSDs ports system for OS X/Darwin) to get it.
Fink definitely has the right packages. On 2016-12-26, it had gcc 5 and gcc 6 packages.
I'm less familiar with how MacPorts works, though some initial cursory investigation indicates they have the relevant packages as well.
Installing XCode requires:
Enrolling on the Apple website (not fun)
Downloading a 4.7G installer
To install g++ *WITHOUT* having to download the MASSIVE 4.7G xCode install, try this package:
https://github.com/kennethreitz/osx-gcc-installer
The DMG files linked on that page are ~270M and much quicker to install. This was perfect for me, getting homebrew up and running with a minimum of hassle.
The github project itself is basically a script that repackages just the critical chunks of xCode for distribution. In order to run that script and build the DMG files, you'd need to already have an XCode install, which would kind of defeat the point, so the pre-built DMG files are hosted on the project page.
Type g++(or make) on terminal.
This will prompt for you to install the developer tools, if they are missing.
Also the size will be very less when compared to xcode
Download Xcode, which is free with an ADC online membership (also free):
http://developer.apple.com/technology/xcode.html
xcode is now available for free from the app store. Just "buy it" (for free) and it will download. To get the command line tools go into preferences/downloads and "install command line compiler tools".
Instead of gcc you are using clang, but it works the same.
Here is how to do it on the newer mac chips and how to switch from clang(default) to g++
Install g++ through home-brew.
Check out the version you just installed, probably 12th or higher
You can make a symbolic link from g++-12 to g++
In order to do it, just type in your terminal:
sudo ln -s $(which g++-12) /usr/local/bin/g++.
Now open a new terminal and check your version again and you should see g++ instead of clang
g++ --version

Mac OS X free C compiler

Is there a small, free C or C++ compiler for OS X, like TCC?
Xcode is not small, or simple like TCC, AFAIK.
I'm looking for something like a GCC binary file or TCC for OS X.
gcc is the most widely used one (and Apple provides official builds of it as part of XCode). XCode is also usually distributed on your OS X cd's, though that version may be a little out of date now, depending on what version of OS X you have.
For information and samples on how to use it, look here.
Look into Fink or one of the similar projects out there if you want a build of gcc that's not linked to Xcode. That said though, Xcode is a great IDE for OS X.
You could use the Xcode Tools that are already included in OSX.
Xcode is the same professional
developer toolset used by Apple to
create Mac OS X, as well as many great
Apple applications, and Xcode is
included with every copy of Mac OS X.
You can use Code::Blocks IDE its simple slick and hav good set of feture, a plus opensurce and ready to dl for 3 major plateforms
still recoment using Xcode if u just have to make projects for MAC, but if u are going to port it to linux and windows, then my choice is Code::Blocks [Give it a try atleast]
I know you want a small compiler, but it is best to just download and install Xcode. It is a great IDE. From there, you don't have to use it if you don't want to. Once it is installed, you can use something like this in terminal:
gcc myFile.c -o myFile
And that would build a source file called myFile.c which contains C code and the output module (executable) would be myFile. You'd execute it by running:
./myFile
Update: What is your reason for not wanting Xcode? Furthermore, is GCC itself ok (disregarding Xcode for a moment)? It's important to know that GCC is not a part of Xcode. Apple made use of GCC, which is an open source C/C++ (and more) compiler.
I just can't find binaries of GCC for mac so downloading Xcode is an easy way to get some...
Update 2: It also just came to my attention that NetBeans will compile C / C++ Code. It also uses the GCC compiler. I'm not sure if it using GCC from my Xcode installation but I thought I'd mention this.
Best Regards,
Frank
There are binary packages for LLVM, both for the Clang and GCC front-ends.
PCC, the Portable C Compiler, is available for the Mac. It is small and free. Its tarball weighs in at total of 1778 KB from its 4th of July CVS Snapshot.
If you don't want to use Xcode install the macports from macports.org and if you like a graphical user interface install porticus as a managment gui for all the installed ports. In Porticus you can now easily install all different versions of gcc without Xcode.
Porticus will compile the packages for your mac and install all the needed dependencies like a Linux packet manager.