1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Converting A C File Into .exe

Discussion in 'C' started by fob500, Jul 13, 2009.

  1. fob500

    fob500 New Member

    Joined:
    Jul 12, 2009
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    0
    Hi could any one tell how to convert a c file into an executable file ?
    Also I have designed a simple screen saver in C ..How can I convert it into a setup program(to install on a windows based computer).Like any other setup program.
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,276
    Likes Received:
    364
    Trophy Points:
    83
    Compiling the source code would generate an executable file in Windows. Which compiler you are using?
     
  3. fob500

    fob500 New Member

    Joined:
    Jul 12, 2009
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    0
    Well doesn''t compiling create an object file ?? I'm using the GCC compiler on a linux platform.
     
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,276
    Likes Received:
    364
    Trophy Points:
    83
    Ohh! then there is nothing called an exe file in Linux BTW
     
  5. fob500

    fob500 New Member

    Joined:
    Jul 12, 2009
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    0
    Yes that is true but it is irrelevant to the question I asked.My friend if you read my first post again I have clearly mentioned
    that
    ---------------------------------------------------------------------------------------------------
    How can I convert it into a setup program(to install on a windows based computer).Like any other setup program.
    -----------------------------------------------------------------------------------------------------
    I merely replied to the question you asked that 'what compiler I was using' I never said that I am trying to have an exe file for linux.

    Anyway let me re phrase my question I have a C program (maybe a screen saver) and I want to make a setup for it so that it can be distributed and installed ON A WINDOWS BOX.Can any one tell me how to go about it.
    Also I have programmed in C on windows long time back on something called 'Turbo C' .Not sure if that was the compiler name that you expected. Does it also produce an exe file when you compile a c program.Thanks
     
  6. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    A compiler creates an object file, and a linker creates an executable.
    The Visual Studio compilers and SDK can be downloaded for free from the Microsoft web site (Visual Studio IDE itself is a premium product that you have to pay for)
    If you don't want that then there are free compilers for Windows, MinGW being one.

    I don't know anything about setup programs but if you search MSDN for "msi" (the install set extension) that should take you to some relevant pages.

    Also I don't know if there are any cross compilers that run on Linux to generate programs that run on Windows, cos that's what you're asking for. Probably best to develop Windows programs on a Windows machine.
     
  7. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,276
    Likes Received:
    364
    Trophy Points:
    83
    You are asking how to goto step2 when you have a big issue with step1.

    If you have an exe I can tell you how to make an installer but unless you have an exe it would be of no help.
     
  8. fob500

    fob500 New Member

    Joined:
    Jul 12, 2009
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    0
    Ok so the problem now is that I have a running program on windows box:)happy: that is not the problem actually) so how do I go about getting an .exe file.When I compile it on windows the output file is it an object or exe file ?
     
  9. fob500

    fob500 New Member

    Joined:
    Jul 12, 2009
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    0
    While we are at it could any one tell ,When we compile a C program on windows and on Linux is there any difference between the output files produced after compilation ?
     
  10. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,276
    Likes Received:
    364
    Trophy Points:
    83
    The output files produced are such that they work on the compiled system. By compiling I meant complete compile / linking and producing output files.
     
  11. fob500

    fob500 New Member

    Joined:
    Jul 12, 2009
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    0
    I guess what I would be interested to know is that if there is any Program which can convert source code(in any language) into an exe file.Plz ignore if not relevant to the current thread.Any help would be appreciated
     
  12. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    Huh? If you've got a running program then you must have an exe file.

    When you compile on ANY platform the result is an object file. Executable files are ONLY generated by linkers. Confusing the matter somewhat is the fact that many IDE's perform a one step build, compiling and linking without requiring separate commands from the user (and for Visual Studio it'll compile, link and start the program with the debugger all with one key). Also to confuse newbs is the fact that people often say compile as shorthand for "compile and link". But get it clear in your mind:

    source code -> compile -> object code

    object code + libraries -> linker -> executable.
     
  13. fob500

    fob500 New Member

    Joined:
    Jul 12, 2009
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    0
    Alrighte that was helpfull.Thanks
     
  14. anir_n

    anir_n New Member

    Joined:
    May 27, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    you can use the build funtion in any compiler like MS visual C++.
    select C source file as file option
    compile the C program and then buil it (clt+F7 then F7)
    the .exe file will be present in the debug folder where the project file is located.
    there are other linkers preent just google
     
  15. subhra44

    subhra44 New Member

    Joined:
    May 27, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    how can i make installer from a exe file??
     

Share This Page