OpenCV source build binaries using Visual Studio 2012, Error LNK1104 & Error C3416

asked 2017-03-11 11:42:59 -0600

raisa_ gravatar image

I asked this question in Stackoverflow as well and still wait for answer.

I'm trying to build OpenCV source using Visual Studio 2012. The binaries were built using CMake and Visual Studio generator. Then Build in Debug & Release mode, by loaded the generated solution file (.sln) in Visual Studio. I've been spending hours try to figure out, and still getting nowhere.

Errors

LNK1104 : Cannot open file '..\..\lib\Debug\opencv_dnn320d.lib"
C3416: 'cv::dnn::createLayerFromCaffe' : an explicit specialization may not be explicitly instantiated

and Warnings

C4512: 'cv::bgsegm::BGSubtractPixel' : assignment operator could not be generated
C4512: 'cv::bgsegm::BGSubtractPixelWithHistory' : assignment operator could not be generated
C4512: 'cv::bgsegm::CNTInvoker' : assignment operator could not be generated    
C4512: '`anonymous-namespace'::RandRowFillParallelLoopBody' : assignment operator could not be generated

My guess ?

When Generate binaries in CMake,I need to uncheck something that actually unnecessary,but what?

What I have done ?

  1. Did several changes in CMake and tried re-configure and re-generate, but it always ended up with the same error in VS2012.
  2. Re-Build in Debug & Release mode again Visual Studio (Yes, Build took time)
  3. Looking up for the same error online, but nothing close to my error case.

And because building process takes like 'forever' in Visual Studio, it would really helpful if someone could help me with information about my error so I can make change in CMake and Generate the new binaries to be built using Visual Studio.

Thanks in advance.

edit retag flag offensive close merge delete

Comments

do you need the opencv_dnn module ? (quite experimental, still ..)

berak gravatar imageberak ( 2017-03-11 11:53:46 -0600 )edit

From the OpenCV official tutorial http://docs.opencv.org/3.2.0/de/d25/tutorial_dnn_build.html (here) It's instructed that BUILD_opencv_dnn parameter must exist and be checked. I'm just following the tutorial. Do you have any advice ? Wouldn't that module be important ?

raisa_ gravatar imageraisa_ ( 2017-03-11 11:58:42 -0600 )edit

again, do you ever plan to import pretrained caffe/torch/tf models for "deep learning" ?

if not so, just disable that module ( cmake -DBUILD_opencv_dnn=OFF ) (for now), and your opencv build will compile fine.

berak gravatar imageberak ( 2017-03-11 12:17:01 -0600 )edit

Hi, thanks for advice ! I have disabled modules : 1. build_opencv_dnn 2. opencv_dnn_BUILD_TORCH_IMPORTER 3. opencv_bgsegm And then Configure and Generate again. But all the same errors & warnings still come up. Another advice ?

raisa_ gravatar imageraisa_ ( 2017-03-11 13:15:55 -0600 )edit

i don't have access to vs2012, but warnings are just ... warnings

berak gravatar imageberak ( 2017-03-11 13:49:18 -0600 )edit

Have you deleted CMakeCache.txt ?

LBerger gravatar imageLBerger ( 2017-03-11 14:04:33 -0600 )edit

Thanks a lot for all advices ! Apparently the BUILD_EXAMPLES module was enabled. I had to uncheck module BUILD_EXAMPLES. Everything works fine now.

raisa_ gravatar imageraisa_ ( 2017-03-11 14:37:35 -0600 )edit