Building 64 bit dll with MinGW 32 bit in Eclipse

后端 未结 3 841
感动是毒
感动是毒 2020-12-10 06:05

I installed the 32 bit version of Mingw 4.7.2 (using the installer) on my Windows 7 64 bit. I use MinGW in an Eclipse C++ project in order to build a .dll file. So far ever

3条回答
  •  执念已碎
    2020-12-10 06:44

    You can set -m64 switch to compile a 64 bit lib.

    These ‘-m’ switches are supported in addition to the above on x86-64 processors in 64-bit environments.

    -m32 -m64 -mx32 Generate code for a 32-bit or 64-bit environment. The -m32 option sets int, long, and pointer types to 32 bits, and generates code that runs on any i386 system.

    The -m64 option sets int to 32 bits and long and pointer types to 64 bits, and generates code for the x86-64 architecture. For Darwin only the -m64 option also turns off the -fno-pic and -mdynamic-no-pic options.

    The -mx32 option sets int, long, and pointer types to 32 bits, and generates code for the x86-64 architecture.

    ( source: http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.html )

    Example:

    32 Bit: gcc -m32 -o exmaple32 example.c

    64 Bit: gcc -m64 -o exmaple64 example.c

    (same with g++)

    You can set them in eclipse: (right click on your project) -> Properties -> C/C++ Build -> Settings

提交回复
热议问题