Thread: compiling for different windows versions

  1. #1
    Registered User
    Join Date
    Aug 2009

    compiling for different windows versions

    Hey new here. I've been programming for a little bit with C++ under Linux and if you dont know when you compile something for Linux its pretty universal because all Linux distros use some version of the Linux Kernel.

    Well for learning sake i want to start a couple projects under windows (which i dont use often). If i want to create a program to work with different versions of windows do i need to compile it under that OS or use certain options? I'm using Microsoft Visual C++ 2008 Express under Windows XP Pro x64. My goal is to compile a program to work under the newer versions of windows such as vista/windows 7.

    Any help would be greatly appreciated.

  2. #2
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    In general you merely have to avoid the use of API calls that arent present in the oldest version of hte OS you want to target. Code written for 95/NT 4.0 will work with XP, Vista, Windows 7, etc.

    You do need to watch much older 16 bit code, as support for some of that has ceased in newer version of the OS.

  3. #3
    Join Date
    Oct 2007
    Inside my computer
    Search for _WIN_VER on MSDN. That should put you into right direction, I think.
    Adjusting _WIN_VER will allow you to select what minimum OS you want to target.
    Any old executable will run fine on newer operating systems (but don't abuse admin privileges, or it will break on Vista/Win7), but the other way around is not true, of course.
    You will be able to use all the function on your minimum OS downwards.
    Last edited by Elysia; 08-03-2009 at 12:35 PM.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #4
    Registered User
    Join Date
    Sep 2004
    For the most part, Microsoft has done an excellent job at preserving backwards compatibility in their Win32 API. This means that 99% of applications will run the same on Vista, XP, and Windows 98 without even recompiling them.

    As abachler said, if you avoid using some of the newer API functions that only exist on the latest OS versions, you will not run into any problems. In the MSDN documentation, it will say what Windows version the API function was introduced in, so just watch out for the ones that were introduced in Vista since a lot of people still run XP.
    bit∙hub [bit-huhb] n. A source and destination for information.

  5. #5
    Registered User
    Join Date
    Aug 2009
    Thanks alot everyone. I really appreciate your time!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Virtual keys
    By Arkanos in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2005, 10:00 AM
  2. Compiling for Windows CE
    By LiX in forum Windows Programming
    Replies: 1
    Last Post: 12-06-2004, 08:53 AM
  3. Time libraries and funtions for Windows C Compiling
    By vmn_3k in forum C Programming
    Replies: 6
    Last Post: 08-14-2003, 01:24 PM
  4. Manipulating the Windows Clipboard
    By Johno in forum Windows Programming
    Replies: 2
    Last Post: 10-01-2002, 09:37 AM
  5. Problem with Borland 5.5 Compiling Windows Programs
    By Unregistered in forum C++ Programming
    Replies: 3
    Last Post: 08-28-2001, 09:04 AM