Compiling Issues

This is a discussion on Compiling Issues within the C Programming forums, part of the General Programming Boards category; Hi, When compiling in emacs in linux i can not run the .exe in windows, though i can in Linux. ...

  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    20

    Compiling Issues

    Hi,

    When compiling in emacs in linux i can not run the .exe in windows, though i can in Linux.

    How do i compile a .c program to run in Windows?

    And likewise when compiling in Dev-C and trying to run the .exe in Linux it doesn't work.

    Any help would be grateful

    Jon

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Ehm, because "everything" is different, except perhaps the processor.

    Windows uses PE/COFF formated executable files, and Linux uses ELF or a.out format executables. On top of that, Windows and Linux have different API's (that is, the functions to read & write files, ask the OS what time it is, or ask for more memory, just to give a few examples) is different. Even the ABI (application binary interface) is different. The ABI is a sort of agreement between the compiler and the OS about "how you transfer information, and what registers to use for what".

    It's like saying "why can't I just take my Ford engine and bolt it straight into my Nissan" - they weren't built to "plug'n'play" together!

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,688
    More cross-border posting.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I like your answer, Salem.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. iterator issues
    By Elkvis in forum C++ Programming
    Replies: 10
    Last Post: 02-05-2009, 08:52 PM
  2. Problem compiling files that store functions
    By tiachopvutru in forum C++ Programming
    Replies: 10
    Last Post: 05-30-2008, 05:42 PM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. Problem Compiling
    By Flakster in forum C++ Programming
    Replies: 4
    Last Post: 06-13-2006, 01:09 AM
  5. Compiling
    By Dae in forum C++ Programming
    Replies: 7
    Last Post: 06-15-2005, 01:08 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21