简体   繁体   中英

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM