如何使用G ++ w / CodeBlocks编译64位? [英] How do I compile for 64bit using G++ w/ CodeBlocks?

查看:1468
本文介绍了如何使用G ++ w / CodeBlocks编译64位?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在创建一个共享lib DLL,但我需要在运行时在64位环境中加载它,因此它目前不工作。



如何使用g ++从代码块编译64位dll?



要使用g ++在Windows上编译64位程序,您需要

https://www.dropbox.com/s/5nv14ecey1bqxuv/MinGW64.zip?dl=0rel =nofollow> MinGW64 。我相信Code :: Blocks自带的MinGW32。



要安装到Code :: Blocks,解压缩到一个没有空格的文件夹,如 C:\MinGW64



打开Code :: Blocks并单击设置 - >编译器和调试器。在所选编译器下,单击复制。在下一个框中,键入类似MinGW 64位编译器并单击确定。



然后在Toolchain可执行文件选项卡上,单击每个选项旁边的浏览按钮,复制到MinGW64到( C:\MinGW64 )的文件夹,并进入 bin 文件夹。设置每个选项如下:



编译器的安装目录:您指定的路径( C:\MinGW64



C编译器: gcc.exe



g ++。exe (如果你使用我的链接,它会是 g ++ 64.exe 提醒我)



动态库的链接器: g ++。exe g ++ 64.exe 如果你使用我的链接)



链接器静态库: ar.exe



调试器:没有一个用于MinGW64,清除此选项并留空



资源编译器: windres.exe



Make程序: make.exe



编译器设置完成后,使用相同的设置编译DLL,只使用64位编译器。


I'm currently working on creating a shared lib DLL but I need to load it at runtime in a 64 bit environment so it currently doesn't work.

How can I compile 64bit dlls from code blocks using g++ ?

I've tried compiler options like -m64 but none seem to work.

解决方案

To compile 64-bit programs on windows using g++, you need MinGW64. I believe that Code::Blocks comes with MinGW32.

To install it onto Code::Blocks, extract the zip file to a folder without spaces, such as C:\MinGW64

Open Code::Blocks and click on Settings -> Compiler and debugger. Under Selected Compiler, click Copy. In the next box, type something like "MinGW 64-bit Compiler" and click OK.

Then on the Toolchain executables tab, click the Browse button beside each option and browse to the folder you copied MinGW64 to ( C:\MinGW64 ) and go into the bin folder. Set each option as follows:

Compiler's installation directory: The path you specified( C:\MinGW64 )

C compiler: gcc.exe

C++ compiler: g++.exe (If you used my link above it will be g++64.exe, thanks Super Cat for reminding me)

Linker for dynamic libs: g++.exe (g++64.exe if you used my link)

Linker for static libs: ar.exe

Debugger: There isn't one for MinGW64 yet, clear this and leave it blank

Resource compiler: windres.exe

Make program: make.exe

Once you have the compiler set up, compile your DLL with the same settings, only using the 64 bit compiler.

这篇关于如何使用G ++ w / CodeBlocks编译64位?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆