Compiling for Windows on Linux

This is a discussion on Compiling for Windows on Linux within the C++ Programming forums, part of the General Programming Boards category; I use linux to program, does anyone know of a plug-in to g++ to cross compile so it can run ...

  1. #1
    Tzu
    Tzu is offline
    Registered User
    Join Date
    Aug 2006
    Posts
    6

    Compiling for Windows on Linux

    I use linux to program, does anyone know of a plug-in to g++ to cross compile so it can run on windows? I know I can just compile it on widows and it runs. I have searched google and i am unable to find anything good.

    Thank you in advance.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,484
    They're called cross-compilers - a compiler which runs on machine 'x' producing code which runs on machine 'y'.

    It's not normally necessary to have a cross-compiler targeting windows since native compilers are common enough. It's only when the target lacks a compiler that you need a cross-compiler.

    Have you tried running say dev-c++ inside WINE?
    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.

  3. #3
    Tzu
    Tzu is offline
    Registered User
    Join Date
    Aug 2006
    Posts
    6
    i was looking for something more built in -- or commandline-ish to make easier for me

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,484
    I've got the world on a stick - how easy do you want everything to be?
    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.

  5. #5
    Tzu
    Tzu is offline
    Registered User
    Join Date
    Aug 2006
    Posts
    6
    I was not intending to offend you, i was asking for command line because i do not run X in linux and thus WINE wont work for me. I generally ssh in to my programming box, and that also does not allow X.

  6. #6
    pwns nooblars
    Join Date
    Oct 2005
    Location
    Portland, Or
    Posts
    1,094
    WINE works on commandline programs too. And the compiler for Dev-C++ is MinGW a windows port of gcc. So install WINE and MinGW and then have at it.

  7. #7
    Tzu
    Tzu is offline
    Registered User
    Join Date
    Aug 2006
    Posts
    6
    Thank you both, I did not want to have to rebuild gcc and make it a cross compiler, but I may have to. For now wine and mingw sound good,

    Once again, thank you

  8. #8
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,436
    Can you do gcc compile across operating systems? I thought it was only across machines.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  9. #9
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    Different operating systems can be run on the same machine.

  10. #10
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Quote Originally Posted by Mario F.
    Can you do gcc compile across operating systems? I thought it was only across machines.
    That wouldn't be a logical restriction. Either the compiler is able to target a platform different than the one it's running on, or it isn't. What that platform is shouldn't matter.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Question about linux compiling with GCC
    By elsheepo in forum C++ Programming
    Replies: 23
    Last Post: 03-07-2008, 10:36 PM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. Compiling Linux kernel on Windows
    By jmd15 in forum Linux Programming
    Replies: 9
    Last Post: 04-10-2006, 07:28 AM
  4. newbie : compiling a C++ program in linux
    By gemini_shooter in forum C++ Programming
    Replies: 5
    Last Post: 06-23-2005, 02:45 PM
  5. Cross Compiling with Linux and Turbo C
    By ozgulker in forum Linux Programming
    Replies: 0
    Last Post: 11-18-2002, 02:07 PM

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