Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
792 views
in Technique[技术] by (71.8m points)

c++ - Netbeans and MinGW-w64

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

Then I opened NetBeans and this was configured:

The configuration in NetBeans

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

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 (exit value 2, total time: 1s)

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

what am I missing?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.

Prerequisites

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 or other suitable IDE
  • 64bit Windows.
  • EnvMan (optional but handy for managing Windows Environment variables.)

Installation

MinGW-W64 C compiler and MSYS

Setup

  • Add 'C:MinGW-W64in' to your Windows PATH variable.
  • Add 'C:MSysmsysin' to your Windows PATH variable.
  • Start Netbeans and go to Tools -> Options -> C/C++.
    • Click 'Add' under 'Tool Collection' and select the base directory of MinGW-W64 (C:MinGW-W64in).
    • Select 'MinGW' from 'Tool Collection Family' if it isn't auto-detected and click 'OK'.
    • Set the 'C Compiler to C:MinGW-W64inx86_64-w64-mingw32-gcc.exe.
    • Set the 'C++ Compiler to C:MinGW-W64inx86_64-w64-mingw32-g++.exe.
    • Set the 'Make Command' to C:MSysmsysinmake.exe.

And that should be it!

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.

Happy coding!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...