MinGWInCCDevelopmentPack

Is it possible to use MinGW in C/C++ Development?

See Configuring the NetBeans IDE for C/C++/Fortran for instructions for installing the MinGW tools in NetBeans IDE 6.7.


Configuring the NetBeans 5.5.1 C/C++ pack to use the MinGW Tools:

Note: This is not necessary with NetBeans IDE 6.0 , 6.1, 6.5 and 6.7. After logging in again or rebooting the PC, NetBeans IDE configures itself appropriately.

In NetBeans 5.5.1, compiling works, but the C++ editor is not aware of the include files and will mark all functions like printf() etc. as missing by a red line. To cure this, choose Tools > Options, select C/C++ in the left pane, and click Parser Settings in the Code Assistance section of the C/C++ Settings page. Choose the appropriate Tab (C or C++ Compiler), click Add, and add all the folders that contain the header files. NetBeans does not search the folders recursively, you have to add each folder.

Multithreading with Posix threads:

If you want to develop multithreaded applications with Posix threads instead of the native windows threads you will also need the Pthread Win32 library:

  • Download pthreads-w32-2-8-0-release.exe.
  • Extract the files into a temporary folder.
  • The folder "Pre-built.2" contains the folders "lib" and "include", copy its contents into the MinGW folders of the same name. (I added the library "libpthreadGCE2.a" to my projects.)
  • Important if using exception handling: Compile your application with the additional compiler switch "-mthreads". Otherwise exception handling will not work reliable and unspecific crashes may occur. Other problems may arise while propagating exceptions out of a DLL into an application. I have found some hints concerning this in the net, but have no experience with it because my DLL does not throw exceptions.


Which make program should I use?

Many MinGW users have a problem because they use mingw32-make.exe from the MinGW installation. While this seems like the right choice, it actually breaks the build. The problem is that this is a non-Posix implementation of the Unix make program and doesn't work well at all. In fact, thats why the MinGW people renamed it! They've also made a FAQ entry explaining why you should not use mingw32-make.exe. Instead, you should use the make.exe program from the MSYS package.

As of NetBeans 6.1, the Build Tools panel no longer allows a user to select mingw32-make. If you choose a MinGW compiler collection it will default to make in MSYS. If MSYS is not found, it will tell you no make program has been found.

Other references

There is another detailed article about C/C++ Pack with the instructions for using a MinGW configuration. http://www.netbeans.org/community/magazine/html/03/c++/

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo