Reputation: 1779
How can I compile it on a 32-bit system so it can run as backward compatible under a 64-bit system? I know it can be done because Adobe, Dropbox and other companies have such binaries. How should I link them, dynamically, statically? Static only some libraries and other dynamic?
I'm talking about a simple code like:
int main() {
printf("Hello world!\n");
}
Thank you!
Upvotes: 0
Views: 711
Reputation: 76519
Typically, you compile either both versions, or compile only a 32-bit version, and require that the user has the 32-bit libraries installed.
You can tell GCC to compile for 32-bit by adding -m32
to every command. Note that this requires a multilib compiler, and you need to have the necessary lib32* files installed.
Upvotes: 2
Reputation: 798626
Normally. Then install the 32-bit libraries on the 64-bit system.
Upvotes: 3