Find the answer to your Linux question:
Results 1 to 5 of 5
Hello, I was wondering if it is at all possible to compile a simple C++ program for 32-bit windows from 64-bit Ubuntu. If it is possible, how would I go ...
  1. #1
    Just Joined!
    Join Date
    Oct 2007
    Posts
    47

    Compiling C++ for windows in linux.

    Hello,

    I was wondering if it is at all possible to compile a simple C++ program for 32-bit windows from 64-bit Ubuntu. If it is possible, how would I go around doing it? I am use to compiling C++ and C for my laptop, because I do it all the time for my math assignments, but how would I be able to compile it for windows?

    Thank-you

  2. #2
    Linux Enthusiast KenJackson's Avatar
    Join Date
    Jun 2006
    Location
    Maryland, USA
    Posts
    506
    Quote Originally Posted by robotichead View Post
    I was wondering if it is at all possible to compile a simple C++ program for 32-bit windows from 64-bit Ubuntu.
    Yes. You need the mingw32 cross compiler. Fedora has several packages with names like mingw32-gcc-c++, and I'm sure Ubuntu's would be similar.

    On my Fedora system, the g++ executable is i686-pc-mingw32-g++, which you use just like g++ to compile programs.
    Code:
    i686-pc-mingw32-g++ helloworld.cpp -o helloworld.exe

  3. #3
    Just Joined!
    Join Date
    Oct 2007
    Posts
    47
    hey KenJackson, it sadly did not work. its not giving me the option of i686-pc-mingw32-g++ at all

  4. #4
    Linux Enthusiast KenJackson's Avatar
    Join Date
    Jun 2006
    Location
    Maryland, USA
    Posts
    506
    Well I just SSH-ed over to my old Ubuntu machine in the corner and ran:
    aptitude search mingw32
    and it came back with three packages:

    mingw32
    mingw32-binutils
    mingw32-runtime


    So try
    Code:
    sudo apt-get install mingw32 mingw32-binutils mingw32-runtime
    Then you will have compiler i586-mingw32msvc-g++ and friends.

  5. #5
    Just Joined!
    Join Date
    Oct 2007
    Posts
    47
    thank-you, it seems to be working now. Much appreciated.

    Just out of curiousity, i also use QT4. Is it possible to do the same thing with QT?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...