Ubuntu under cross compilation Windows C program

Source: Internet
Author: User

Brief introduction

Using MINGW32 can be directly compiled under Linux C program output for Windows EXE program or DLL link library.

Personal compiled pure C program (without WINAPI), mainly C99 program, usually gcc/cc compiled debugging, and then use MinGW output win target file.

The target programs and shared libraries under Linux are different from the applications and link libraries under Windows.

Specific steps
    1. Installing MinGW

      sudo apt-get install mingw32 mingw32-binutils mingw32-runtime

      Automatic installation even if mingw32-binutils and Mingw32-runtime are not entered

    2. Compile

      I586-MINGW32MSVC-GCC Hello.c-o Hello.exe

    3. Personal habits

      Alias cl= ' I586-mingw32msvc-gcc-std=c99 '

      CL *.o-mdll-o Test.dll

      CL Hello.c-o hello.exe

MinGW command
    • C COMPILER:I586-MINGW32MSVC-GCC
    • C + + compiler:i586-mingw32msvc-g++
    • Linker for Dynamic libs:i586-mingw32msvc-g++
    • Linker for Static Libs:i586-mingw32msvc-ar
    • Debugger:i586-mingw32msvc-gdb

Http://hustlei.tk/2014/08/ubuntu-compile-c-for-win.html

Ubuntu under cross compilation Windows C program

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.