Question

How do I know if the program I am writing in C++ will run properly in a 32-bit OS or not?
(without manually testing in one)

I am using Visual Studio and compiling in a 64-bit machine. Will that stop the program from working in other machines?

And what about the processor and Windows version? Will the binary be compatible with most Windows versions and processors, if the program just does a few simple things such as web requests and calculations, with a simple user interface?

My program doesn't have to be 64-bit. I would just like to create one binary that runs in most computers, like those I download every day on the Internet. How could I do that?

Était-ce utile?

La solution 2

An executable compiled and linked for 64-bit will typically also require 64-bit libraries.

Use tools like the Dependency Walker to find out, if a given executable is refering to 32- or 64-bit libraries.

In Visual Studio, the "target platform" decides which CPU architecture you are targeting. It is perfectly feasible to create 64-bit executables on a 32-bit system, but you can't actually run them on such a machine.

Autres conseils

If you are building your code specifically for 64-bit Windows, you can't expect the binary to work on 32-bit Windows. That will require a separate build.

You can do what's called cross-compiling i.e compiling on one machine for another. How to compile a 32-bit binary on a 64-bit linux machine with gcc/cmake This is what you're after if I read you correctly. There should be a Windows equivalent.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top