lundi 25 janvier 2016

Compiling c++ software compatible with different os machines

Im trying to migrate software developed in c98 standards to c++11 but i have some general questions i couldnt find an unequivocal answer to.

First of all is there any dependancy between the executable binary to the combination of the version of the compiler used plus the target os machine or is it is only dependant on the version of the compiler itself? or only the os?. Let say i compile c++ program in both windows xp + windows 7 using the same compiler (visual studio 2010 with the same configuration) would the executable be the same? would it work in both windows 7 and windows xp regardless where i compile it?

My second question, when i compile the program on one machine and my program uses header files and classes from the standard library when i will run it on another os machine (lets say both centos linux version 6.0) would it work? because eventually after i compile, everything is interpreted into machine code right? (so my guess it should work, but correct me if im wrong... :\ )

So i want to upgrade my compiler to support c++ 11 standards but im not sure if it will work on my other machines when i deliver the executable software... lets say i dont touch those machine whatsoever only deliver them the executable.

When i will upgrade my gcc compiler would it also install certain libraries and header files that i wont have on my second machine that would cause issues when i will try to run the compiled binary there?

Thank you i always wanted to understand once and for all how does the compiler work behaind the scene.

By the way if there wont be option to upgrade and be sure it will work, is there any transpiler that convert code from c++11 to c98?, that would save me the need to upgrade the compiler version...

Thank you.

Aucun commentaire:

Enregistrer un commentaire