Are g++ Ubuntu compiled programs compatible with other dsitros?

I have compiled a console application with g++ on Linux Mint 16, which is based on Ubuntu 13.10. I compiled a console program with g++. Here is the output of the Terminal when I write g++ --version here is the output:
g++ (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
...
First, is the output program compatible with other Linux distibutions? If not how can I compile it for other distros? I would want the following distros:
Red Hat
Fedora
Debian
Ubuntu (already there)
Arch Linux
Last edited on
closed account (L6b7X9L8)
I believe if you compile on Linux it should work for the rest. The program is compiled to be used on the Linux kernel, so if they are all Linux based OS's I think it should all work fine.

I'm not entirely sure but that is what I am lead to believe.
Assuming that the libraries it's linked against exist and are available on the path of the other distros, yes.
It only uses the STL... Thanks guys!
Different distros have different versions of same (STL) library. Linking against newer version can create dependency on versions symbols that do not exist on older systems.

Virtual machines is a possibility.

Distributing as source should be the simple method, depending on the build system (autotools, cmake, or whatnot).
Link statically against libstdc++, libgcc or whatever library your compiler is using and it should work as there is no other depedencies.
I'm just guessing, but I suppose you have an Intel or amd box.
Those binaries defenately won't run on my arm box or on mips or any of the other cpu architectures.
Topic archived. No new replies allowed.