Netbeans 和 MinGW-w64 [英] Netbeans and MinGW-w64

查看:69
本文介绍了Netbeans 和 MinGW-w64的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 win7 64 位上配置我的 NetBeans,以使用 MinGW-w64.
所以我在 %PATH% 变量中放入了编译器的以下路径:
C:mingw-w64-bin_i686mingwin
C:minGw-MSYSmsysin
C:mingw-w64-bin_i686libexecgccx86_64-w64-mingw324.7.0

I'm trying to configure my NetBeans on win7 64bit, to work with the MinGW-w64.
So I put in the %PATH% variable the following paths of the compiler:
C:mingw-w64-bin_i686mingwin
C:minGw-MSYSmsysin
C:mingw-w64-bin_i686libexecgccx86_64-w64-mingw324.7.0

然后我打开 NetBeans 并进行了配置:

Then I opened NetBeans and this was configured:

NetBeans 中的配置

我尝试编译一个小测试程序,但收到此错误:

I tried to compile a little test program but I received this error:

g++.exe:致命错误:-fuse-linker-plugin,但 liblto_plugin-0.dll 不是发现编译终止.制作[2]:*[dist/Debug/MinGW-Windows/test.exe] 错误 1 ​​make1: [.build-conf]错误 2 制作:** [.build-impl] 错误 2

g++.exe: fatal error: -fuse-linker-plugin, but liblto_plugin-0.dll not found compilation terminated. make[2]: * [dist/Debug/MinGW-Windows/test.exe] Error 1 make1: [.build-conf] Error 2 make: ** [.build-impl] Error 2

BUILD FAILED(退出值2,总时间:1s)

BUILD FAILED (exit value 2, total time: 1s)

我确实在 C:mingw-w64-bin_i686libexecgccx86_64-w64-mingw324.7.0 中有这个文件

I do have this file in C:mingw-w64-bin_i686libexecgccx86_64-w64-mingw324.7.0

我错过了什么?

推荐答案

好吧,在推迟了 几个月 之后,我终于坐下来完成了.我可能会在我的博客上用漂亮的图片发表更详细的帖子,但这里有一个精简的 SO 版本,希望足以让你(和其他人)开始使用.

Right, after months of putting this off I've finally sat down and done it. I'll probably make a more detailed post on my blog with pretty pictures but here is a trimmed down SO version which will hopefully be enough for you (and everyone else) to get going with.

删除 MinGW、MSYS 和 CMake,如果你有它们并且可以承受丢失它们(我们将重新安装 MinGW(obv.)和 MSYS,但不会重新安装 CMake,因为它似乎不需要.)

Remove MinGW, MSYS and CMake if you have them and can afford to lose them (we will reinstall MinGW (obv.) and MSYS but not CMake as it doesn't appear to be needed.)

  • Netbeans 或其他合适的 IDE
  • 64 位 Windows.
  • EnvMan(可选但方便管理 Windows 环境变量.)
  • Netbeans or other suitable IDE
  • 64bit Windows.
  • EnvMan (optional but handy for managing Windows Environment variables.)

MinGW-W64 C 编译器和 MSYS

MinGW-W64 C compiler and MSYS

  • 下载并安装MinGW-W64
    • http://mingw-w64.sourceforge.net/(链接位于左侧菜单中与名为WIN64 下载"的超链接.)
    • 有很多版本,可能有点复杂.我们是与 mingw-w64-bin_i686-mingw_20111220 一起使用(尽管数字在最后可能会有所不同)这基本上是说我们想要版本使用 Windows 二进制文件.
    • 下载完成后(大约 300mb,所以 10 分钟左右)解压缩到C:MinGW-W64 或类似的.确保没有空格路径!
    • Download and install MinGW-W64
      • http://mingw-w64.sourceforge.net/ (link is on the left menu with a hyperlink called 'WIN64 Downloads'.)
      • There are a lot of versions which can be a bit complicated. We are going with mingw-w64-bin_i686-mingw_20111220 (although the numbers at the end may be different) which basically says we want the version with the windows binaries.
      • Once the download is complete (about 300mb so 10min or so) extract to C:MinGW-W64 or similar. Make sure there aren't any spaces in the path!
      • Took a bit of searching http://sourceforge.net/apps/trac/mingw-w64/wiki/MSYS is the wiki for it and http://sourceforge.net/projects/mingw-w64/files/External%20binary%20packages%20%28Win64%20hosted%29/MSYS%20%2832-bit%29/ is where I found the download and the version I went with was MSYS-20111123
      • Once the download is complete extract the files to C:MSys or similar. Make sure there aren't any spaces in the path!
      • 将C:MinGW-W64in"添加到您的 Windows PATH 变量中.
      • 将C:MSysmsysin"添加到您的 Windows PATH 变量中.
      • 启动 Netbeans 并转到工具 ->选项 ->C/C++.
        • 单击工具集"下的添加"并选择MinGW-W64 (C:MinGW-W64in).
        • 如果不是,请从工具集合系列"中选择MinGW"自动检测并点击确定".
        • 将C 编译器"设置为 C:MinGW-W64inx86_64-w64-mingw32-gcc.exe.
        • 将C++ 编译器"设置为 C:MinGW-W64inx86_64-w64-mingw32-g++.exe.
        • 将生成命令"设置为 C:MSysmsysinmake.exe.

        应该就是这样!

        我应该注意,我正在使用系统编译要通过 JNI 使用的库文件,因此有一些额外的步骤,我错过了,因为这里不需要它们.然而,我制作了一个快速的Hello World"程序,它编译并运行良好.

        I should note that I am using the system to compile a library file to be use via JNI so have some additional steps for that which I missed out as they weren't needed here. However I made a quick 'Hello World' program and it compiled and ran nicely.

        快乐编码!

        这篇关于Netbeans 和 MinGW-w64的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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