Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8548933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:36:42+00:00 2026-06-11T13:36:42+00:00

i have installed minGW on my PC according to http://netbeans.org/community/releases/72/cpp-setup-instructions.html , and i have

  • 0

i have installed minGW on my PC according to http://netbeans.org/community/releases/72/cpp-setup-instructions.html, and i have “restored defaults” using NetBeans 7.2 who has found all necessary files.

But when I made test sample C++ app i got following error:

c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: cannot find   -ladvapi32 
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: cannot find -lshell32 
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: cannot find -luser32 
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: cannot find -lkernel32 
collect2: ld returned 1 exit status 
make[2]: *** [dist/Debug/MinGW-Windows/welcome_1.exe] Error 1 
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2

Can anyone give me a hand with installing openCV and minGW for NetBeans?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T13:36:44+00:00Added an answer on June 11, 2026 at 1:36 pm

    How to build and use openCV with Netbeans 7.2 . Step by step

    Preparations

    In the “c:\mingw\bin” and “c:\mingw\lib”

    • Search and delete all libopencv*.dll , libopencv*.dll.a , libopencv*.a

    Tested with the following programs

    Download OpenCV-2.4.2.exe (222.9 MB) http://sourceforge.net/projects/opencvlibrary/files/
    Download mingw-get-inst-20120426.exe (662.7 kB) http://sourceforge.net/projects/mingw/files/
    Download cmake-2.8.9-win32-x86.zip http://www.cmake.org/files/v2.8/cmake-2.8.9-win32-x86.zip

    All references used in this manual:

    All references in this manual begin with “T: \”. Please change to the actual drive letter! ( mostly “c:\” )

    • C:\msys\1.0\src — (If no “msys” exists, create or use
      “C:\mingw\src”).
    • C:\mingw\bin

    Note:
    I use for new projects in the msys-mingw environment always the “C:\msys\1.0\src” directory.
    To have the same conditions, gcc should also be “4.7.0” not “4.6.2”

    • Put at the front of your PATH “C:\mingw\bin;C:\msys\1.0\bin;”

    As you’ve probably noticed, you can not use the libraries that come with OpenCV-2.4.2.exe.
    Ignore so the folder “…\opencv\build\x86\mingw\bin” and “…\opencv\build\x86\mingw\lib” completely.

    Let’s get the new mingw files.

    Start mingw-get-inst-20120426.exe

    Use : Download latest repository …

    enter image description here

    Make sure that the specified directory is correct, usually “C:\mingw”.
    Check as described below.
    If you also need msys, then also select “MinGW Developer Toolkit”.

    MinGW Install

    Now MinGW-Get downloads all new files. ( 4.7.0 )

    Run “OpenCV-2.4.2.exe”.

    The folder where the files go should be “c:\msys\1.0\src”.
    That writes all the files in the new directory “opencv”.
    The new folder : “C:\msys\1.0\src\opencv“. From now on, this is our top-level directory

    Open “cmake-2.8.9-win32-x86.zip” and copy the files to your cmake folder.

    Creating the Makefiles

    Run “C:\cmake\bin\cmake-gui.exe“

    • A: Set the required fields, click “configure”
    • B: Set, click “next”
      enter image description here

    • Set and click “ok”
      enter image description here

    A possible error: sh.exe was found in your PATH

    • A: Error “sh.exe was found in your PATH”
    • B: Search for sh.exe in “C:\msys\1.0\bin” or “C:\mingw\bin” and
      rename to “shxx.exe”

    • click “configure” again.

    enter image description here

    A possible error: CMAKE_MAKE_PROGRAM is not set

    • mark “CMAKE_MAKE_PROGRAM” and copy, click “Add Entry”

    enter image description here

    • Paste, Set and click “ok”
    • click “configure” again.

    enter image description here

    Now it should work. Cmake searches the compiler environment

    enter image description here

    Cmake shows the option page

    • Scroll through the red options. Don’t change anything
    • click “configure” again

    enter image description here

    Let’s generate the Makefiles

    • click “Generate”

    enter image description here

    Building openCV

    • Run “cmd” go to the directory “C:\msys\1.0\src\opencv\build\mingw”. There typing “make”

    enter image description here

    Please wait!

    It takes about 4 hours on my computer

    enter image description here

    Check that all files are in the right place

    • B: *.dll in “C:\msys\1.0\src\opencv\build\mingw\bin”
    • C: *.dll.a in “C:\msys\1.0\src\opencv\build\mingw\lib”

    enter image description here

    Building an opencv program

    • create a new folder “OpenCV-MakeC” in “C:\msys\1.0\src\opencv”
    • create in the folder “OpenCV-MakeC” a “Makefile” and “imgdisplay.cpp”.

    To avoid copy and paste error. Here are the 2 files for download:

    enter image description here

    Makefile

    MKDIR_P = C:/msys/1.0/bin/mkdir -p
    DESTDIRB = build/Debug
    DESTDIRD = dist/Debug
    LIBDIRCV = ../build/mingw/lib
    CFLAGS = -O2
    CXX = C:/mingw/bin/g++.exe
    Applic = imgdisplay
    
    ALL: imgdisd
    
    imgdisd:
        $(CXX) $(CFLAGS) -c -g $(Applic).cpp -I../build/include -MMD -MP -MF $(DESTDIRB)/$(Applic).o.d -o $(DESTDIRB)/$(Applic).o
        $(CXX) $(CFLAGS) -o $(DESTDIRD)/$(Applic) $(DESTDIRB)/$(Applic).o -L../build/mingw/bin $(LIBDIRCV)/libopencv_calib3d242.dll.a $(LIBDIRCV)/libopencv_contrib242.dll.a $(LIBDIRCV)/libopencv_core242.dll.a \
        $(LIBDIRCV)/libopencv_features2d242.dll.a $(LIBDIRCV)/libopencv_flann242.dll.a $(LIBDIRCV)/libopencv_gpu242.dll.a $(LIBDIRCV)/libopencv_highgui242.dll.a $(LIBDIRCV)/libopencv_imgproc242.dll.a \
        $(LIBDIRCV)/libopencv_legacy242.dll.a $(LIBDIRCV)/libopencv_ml242.dll.a $(LIBDIRCV)/libopencv_nonfree242.dll.a $(LIBDIRCV)/libopencv_objdetect242.dll.a $(LIBDIRCV)/libopencv_photo242.dll.a \
        $(LIBDIRCV)/libopencv_stitching242.dll.a $(LIBDIRCV)/libopencv_ts242.a $(LIBDIRCV)/libopencv_video242.dll.a $(LIBDIRCV)/libopencv_videostab242.dll.a 
    md:
        $(MKDIR_P) "$(DESTDIRB)"
        $(MKDIR_P) "$(DESTDIRD)"
    

    imgdisplay.cpp

    /* 
     * File:   imgdisplay.cpp
     * Author: Administrator
     *
     * Created on 14. September 2012, 01:12
     */
    
    #include <cstdlib>
    #include <opencv/cv.h>
    #include <opencv/highgui.h>
    
    using namespace std;
    
    int main( int argc, char* argv[] ) 
    {
    
        cvNamedWindow("mainWin", CV_WINDOW_AUTOSIZE); 
        cvMoveWindow("mainWin", 100, 100);
        IplImage* img;
        img = cvLoadImage("D:/grafik/Lightroom/light01.jpg");
        if (!img) {
            std::cout << "Could not open the image file" << std::endl;
            return -1;
        }
        cvShowImage("My Picture", img); 
        cvWaitKey(0);
        cvReleaseImage(&img);
        return 0;
    }
    

    Netbeans 7.2 create a project

    • File — New Project

    enter image description here

    Use settings as described below.

    enter image description here

    Created Project

    enter image description here

    Create a new target

    • Click with the right mouse button on “Makefile”

    Note: If you get an error : Makefile:12: *** missing separator. Stop.

    Mostly a copy and paste error ! (Make sure no spaces at the start lines. But 2 tab set).

    enter image description here

    Create new folder

    • Click with the right mouse button on “Makefile”
    • Use the new target “md”

    enter image description here

    The projects folder now looks like ..

    enter image description here

    Build the project

    enter image description here

    Debug the project

    • Copy needed dll’s ( C:\msys\1.0\src\opencv\build\mingw\bin to T:\msys\1.0\src\opencv\OpenCV-MakeC\dist\Debug)

    enter image description here

    • Open imgdisplay.cpp (double click)
    • Set breakpoint Line 17

      17 cvNamedWindow(“mainWin”, CV_WINDOW_AUTOSIZE);

    • Click the Debug button

    enter image description here

    Program stops on Line 17

    enter image description here

    Unresolved Identifier

    If the source of the .cpp file looks like this

    enter image description here

    Click with the right mouse button on your project.
    Check C/C++ Code As...
    Run Reparse Project.

    enter image description here

    If that is not enough.
    Go to Project Properties
    Fill in the Include input field as described.

    enter image description here

    Clean Up

    • If you renamed sh.exe to shxx.exe ! Rename it back !
    • If you have spaces in your PATH Variable, put quotation marks around spaces (only around relevant programs like visual studio and so).
      I know that they are not necessary but one or two programs can’t handle the spaces
      in the PATH !!
    • On a
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok. I just installed Qt from: http://qt.nokia.com/downloads using the online installer. I have MinGW,
I have installed and configured NetBeans 6.7 for c++ according to the official manual:
I have installed C/C++ plugin in Netbeans 7.1 and configured MinGW. But when I
I installed GNUStep http://www.gnustep.org/experience/Windows.html but when compiling helloworld.m I got libgmp-10.dll missing. What should
In order to develop qt application on eclipse, i have installed mingw, qt and
I have installed Vim and MinGW on my machine, so I try to create
I have Qt installed + Qt Eclipse Integration + MinGW but I can't seem
I have installed Qt libraries, minGW and Creator with net-install. If I run application
I have installed mingW to use gcc, platform windows 7. I am trying to
I have just installed MinGW and in the bin folder I can see 7

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.