简体   繁体   中英

Building programs on multiple platforms?

I often build programs in c++ and compile them on my own PC. I'm currently using operating system win xp.

If I want to build copies of my program which will run on linux, other versions of windows etc is there a way of doing this without purchasing those operating systems? For example, you can get Cygwin to run windows applications on linux. If I had something like that installed could I compile windows products on linux and use them on another windows machine (same bit size)?

Or, do I have to buy the operating system every time? I'm looking for the most cost effective way of doing this as to build all the libraries I need etc takes allot of time and I'm only using one operating system. How do others get around this problem?

Thanks

You could use cross compilers for creating the binaries. A cross compiler enables you to compile code on one architecture for a different architecture, for example a binary for an Android smartphone on Windows. But the output should be tested on the relevant platform, so you still need to "buy" the operating systems because otherwise you can not do your testing.

If you don't want to spend the money you could reinstall evaluation versions in a virtual machine. Microsoft offers evaluation versions of their operating system, but you will have to reinstall after they expire (which will be after 30 to 90 days, sometimes more). The advantage of a virtual machine is that the hard drive of the virtual pc is simulated in a bunch of files stored on your regular drive. So you need not invest in several hard drives, just plan for 20 - 60 gb per operating system.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM