Difference between cross GCC and MacOSX GCC on eclipse - c++

I've just downloaded the eclipse IDE for C/C++ developers I wanted to start a new project.
After choosing the location for the file, I was asked to choose between these two toolchains:
cross GCC
and
MacOSX GCC.
What's the difference?
Which one should I choose?

In CDT, Cross GCC is a cross-compiler project, one that can build binaries for other platforms/architectures. MacOSX GCC builds only for Mac.
This happens in other operating systems too. If you run CDT in Linux, you must select between Cross GCC and Linux GCC. In Windows, you may select between Cross GCC, Cygwin GCC and Microsoft Visual C++

As #Jaime said, "In CDT, Cross GCC is a cross-compiler project, one that can build binaries for other platforms/architectures. MacOSX GCC builds only for Mac."
But for guidance on which one to choose, according to this article, Cross GCC won't work in Eclipse, so MacOSX GCC is the way to go:
make sure that you select “MacOSX GCC”. I experienced that selecting
the other option (i.e., Cross GCC) does not allow eclipse to run your
project. In fact, by choosing this wrong option you’ll get the
annoying message of “Launch fail. Binaries are missing” when you try
to run your project.

Related

Relationship between gcc, g++, cygwin, and wingw?

I know for my class, I had to install cygwin to get my Netbeans IDE running, but I see options during setup for both g++ and gcc and I am not sure if they are the same thing or not, and where does wingw? is it another compiler, and if so why choose on over the other?
g++ and gcc are the gnu C++ and C compiler respectively. They're really the same compiler with different flags though.
MinGW is "Minimalist Gnu for Windows". It's a port of the gnu compiler to run on Windows.
Cygwin is another port of the gnu compiler (and various other utilities) to Windows. More accurately (IMO, anyway), it's leaving the compiler/programs running on POSIX, and porting a POSIX layer to run on Windows.
As to choosing between them: if you're running Linux, you probably want ot just get a package of gcc/g++ for the distro you're using.
If you're running Windows, it'll depend on your intent. Cygwin works well for porting existing Linux/POSIX code to Windows. If, however, you plan to write code, and just want a compiler, I'd go for MinGW instead.
One other note: the MinGW at MinGW.org hasn't been updated in years. If you decide to go with MinGW, I'd advise getting it from nuwen.net instead (it's updated quite regularly).
gcc will compile: .c/.cpp files as C and C++ respectively.
g++ will compile: .c/.cpp files but they will all be treated as
C++ files.
Also if you use g++ to link the object files it automatically
links in the std C++ libraries (gcc does not do this).
gcc compiling C files has less predefined macros.
For wingw, did you mean mingw? Because MinGW is for compatibility with Windows. MinGW uses GCC/G++, and MinGW is not a compiler, it's basically a stripped version of Cygwin that uses MS libs wherever possible.
Depends upon what you are building;
gcc is for C programs.
g++ is for C++ programs.
I've not heard of wingw.

Where can I download GCC 4.3.2 binaries for Windows?

I have to write a c++ program, and i want to do this in vstudio 2010, because it's the most comfortable way for me. But later this code will be compiled in gcc 4.3.2 (ejudge). I can't find gcc 4.3.2 binaries for Windows, if there any ways to check correctness of gcc compilation? Or maybe anyone will help to find gcc binaries? I found this link http://tdm-gcc.tdragon.net/download but there i can't find 4.3.2 version binaries, only source code. Thanks.
MinGW, or Minimalist GNU for Windows, is a set of GNU compilers for Windows platforms. It's the easiest way to use G++ on windows platform. You could also use Cygwin, but it would be a bit of overkill.
As I recall g++ 4.3.2 was used in an older version of the Code::Blocks IDE, as the bundled compiler.
However, I'm currently unable to connect to [http://www.codeblocks.org], so I don't know if they provide downloads of older versions.

having trouble with winavr gcc in eclipse c/c++

I am using eclipse c/c++ when i create a c project then it does not shows winavr gcc in the toolchain list but i have installed WinAVR-20100110 in c drive and my eclipse is also in the same directory.
it shows cygwin,solarize,linux,macosx,mingw gcc
Eclipse does not look for AVR toolchain by default, even if it is in path (you did add it there?). You need to create an cross GCC project, then tell it the prefix of your toolchain (avr- i guess). When you select "New C project" select Cross GCC in Toolchains listbox, then in next step enter the prefix, set path to toolchain (if not in path), etc. For this you need to install "GCC Cross Compiler Support". You do this from Help -> Install new software -> Mobile and Device development. You will probably also want at least GDB hardware debugging.
You can also try special eclipse plug-in for AVR.

Searching for a C/C++ IDE for OS X that can use a custom gcc installation

I'm on OS X 10.7.2 "Lion", and I'm developing a C program that has to use some OpenMP 3.0 specific functionalities. Therefore, gcc 4.2.1 is not enough for me, I need gcc 4.4 or better.
I downloaded MacPorts and easily installed gcc 4.4. Running it from the command line just works fine, and compiles my OpenMP 3.0 C program with no hassle.
But it's quite annoying for me to edit the source in Xcode or TextWrangler and compile it from the command line. So I tried Code::Blocks, which took me 1 hour trying to make it work under OS X, but it crashes anytime for no reason. Then I tried Eclipse, but it sticks on using gcc 4.2.1 even if gcc 4.4 is installed and can be run from the command line. Finally, I tried MonoDevelop, which uses gcc 4.2.1 as well and I just can't see how can I force it to use my favourite gcc version.
What I'm kindly asking you is: is there any decent C/C++ IDE for OS X that I can use which will let me to specifiy what gcc version to use (just like Code::Blocks under Windows) without horrible workarounds and/or breaking gcc 4.2.1 (I need it up and working for Xcode)?
Thanks in advance.
You should be able to use your gcc with Xcode, without breaking the existing gcc toolchain. Follow these instructions (which describe how to use a custom clang build, but the same principle applies to gcc).
Eclipse is OK, it can be configured to use any compiler (or several at once or whatever).
it sticks on using gcc 4.2.1 even if gcc 4.4 is installed and can be run from the command line.
If you want a global setting, then go to C/C++ / Build / Environment in your preferences and set its PATH to wherever your favourite GCC is.
If you want to be more specific, you can edit a specific project's preferences, for instance:
C/C++ Build / Environment -> Environment variables to set (there you can find and customize the final PATH that your compilation will use, per build configuration)
C/C++ Build / Settings -> GCC C++ Compiler (and others) - there you can customise the exact binary file of the compiler to execute (defaults to just g++), again per build configuration.
This even lets you have a project with 2 build configs, one for GCC 4.2 and one for GCC 4.4 for instance.

GNU gcc and g++

Are the gcc and g++ compilers installed on a MAC OS X machine different from the ones on Ubuntu (Linux) GNU gcc and g++ compilers?
I am using Eclipse to develop a C++ program and there is toolchain section where it says MacOSX GCC and I was wondering if I need to install another compiler so that the executable would also run on Linux machines.
I am a bit new to the technical details of C++ development so I am sorry if this question does not make sense.
It it very unlikely that binary will execute on both Mac and on Linux. If is pretty likely that a binary will not execute between different distro's of Linux. You can either compile you binary for each OS. Or you can distribute the source code for you application and let you users compile it themselves.
Different versions of libstdc++.so are likely distributed with different OS's and this will cause you problems. A solution that partly works is to statically compile your binary so you are not depending on the target systems installed version of libraries.
MacOS is not Linux, it might have a bit in common with BSD, but definitely not Linux. They do, or can, use different configurations of the same compiler, but the programs are not compatible.
The only way you're going to run the same program on both is if you have something like Wine to provide a compatibility layer.