linux – C program runs on Raspberry Pi (32bit) but not on Windows 10 (64 bit)

I have written a C program on the RPi, compiled it using its gcc compiler and it runs exactly as it should. Basically: opens a file for read and a second file for write. It reads the input file character by character (as opposed to line by line), filters out the comments, and writes what’s left to the output file character by character. Took the same source file and compiled it under Windows 10 using its gcc compiler. Compiled fine but when run it hangs part way through the process and does not close the input or output file. The executable file on the Windows machine is 32 bit although the machine itself is 64 bit.

I expected the file compiled on the Windows machine to execute correctly (as it does on the RPi). Have tried changing the content of the file being processed (which is autogenerated code from the STM Cube IDE) but that does not help. Do I need to explicitly tell the Window’s compiler to produce 64 bit code ? I understood that 32 bit code would run under a 64 bit system – am I wrong here ?

Read more here: Source link