2

Alright, So here is the simple code, [Error Snapshot and Output Log at the bottom]

Update: I have already changed the library names (Debug+Release) from 248 to 2413)

Update2: Turning On: Configuration Properties -> C/C++ -> Preprocessor -> Preprocess to a File changes the error to LNK1104 error>Line 1.

#include<opencv2\highgui\highgui.hpp>
#include<iostream>
using namespace std;
using namespace cv;
int main(void)
{
       Mat frame;
       frame=imread("room.jpg",CV_LOAD_IMAGE_UNCHANGED);
       while (waitKey(30)!=27) //27 is ascii equivalent of esc key
       {
              imshow("Image", frame); //loop line 1
       }
}

Here are my OpenCV configuration settings I used for Visual Studio 2012 that I followed from this tutorial (https://www.youtube.com/watch?v=v-VgWxkVp2w)


  1. Download OpenCV 2.4.8 ( but I'm using version 2413]

  2. Create a Win32 console application

  3. Config opencv.. 3.1. Menu Project ---- $ProjectName Properties

3.2. Choose Configuration Manager... and add x64 platform

3.3. At configuration field, choose All configuration 3.3.1. At Configuration Properties ---- C/C++ ---- Additional Include Directories, add opencv include folders

$opencv\build\include
$opencv\build\opencv
$opencv\build\opencv2 

NOTE: $opencv is a folder that you have installed opencv

3.3.2. At Configuration Properties ---- Linker ---- Additional Library Directories, add opencv library folder $opencv\build\x64\vc11\lib

3.4. At configuration field, choose Debug mode 3.4.1. At Configuration Properties ---- Linker ---- Additional dependencies ----

add dependence libraries opencv_stitching248d.lib opencv_contrib248d.lib opencv_videostab248d.lib opencv_superres248d.lib opencv_nonfree248d.lib opencv_gpu248d.lib opencv_ocl248d.lib opencv_legacy248d.lib opencv_ts248d.lib opencv_calib3d248d.lib opencv_features2d248d.lib opencv_objdetect248d.lib opencv_highgui248d.lib opencv_video248d.lib opencv_photo248d.lib opencv_imgproc248d.lib opencv_flann248d.lib opencv_ml248d.lib opencv_core248d.lib

NOTE: These file above are located at .\opencv\build\x64\vc11\lib\

3.5. At configuration field, choose Release mode 3.5.1. At Configuration Properties ---- Linker ---- Additional dependencies ---- add dependence libraries opencv_stitching248.lib opencv_contrib248.lib opencv_videostab248.lib opencv_superres248.lib opencv_nonfree248.lib opencv_gpu248.lib opencv_ocl248.lib opencv_legacy248.lib opencv_ts248.lib opencv_calib3d248.lib opencv_features2d248.lib opencv_objdetect248.lib opencv_highgui248.lib opencv_video248.lib opencv_photo248.lib opencv_imgproc248.lib opencv_flann248.lib opencv_ml248.lib opencv_core248.lib NOTE: These file above are located at .\opencv\build\x64\vc11\lib\

3.6. Add $opencv\build\x64\v11\bin to System Environment Path 3.7. Restart Visual studio


So previously it was working with VC11, then I included imgproc in my code, and ever since this error doesn't seem to go away. I even tried using VC12.

Why I am seeing this error, I'm not even using imgproc in my code?

Yes, I have been a good sport and I searched like 20-25 related posts but in vain. So I really need an expert's advice, who can be a beginner in this, because as you can see from the code I am completely new to OpenCV.

Thanks in advance people.


OutPut:

1>------ Build started: Project: OpenCV2, Configuration: Debug x64 ------ 1> Source.cpp 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(141): error C2146: syntax error : missing ';' before identifier 'ksize' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(141): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(142): error C2146: syntax error : missing ';' before identifier 'anchor' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(142): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(224): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(224): error C2143: syntax error : missing ',' before '<' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(234): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(234): error C2143: syntax error : missing ',' before '<' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(241): error C2061: syntax error : identifier 'Size' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(243): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(243): error C2143: syntax error : missing ',' before '&' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(249): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(249): error C2143: syntax error : missing ',' before '&' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(260): error C2146: syntax error : missing ';' before identifier 'ksize' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(260): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(261): error C2146: syntax error : missing ';' before identifier 'anchor' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(261): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(263): error C2146: syntax error : missing ';' before identifier 'wholeSize' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(263): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(264): error C2146: syntax error : missing ';' before identifier 'roi' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(264): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(267): error C2143: syntax error : missing ';' before '<' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(267): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(267): error C2238: unexpected token(s) preceding ';' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(269): error C2143: syntax error : missing ';' before '<' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(269): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(269): error C2238: unexpected token(s) preceding ';' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(270): error C2143: syntax error : missing ';' before '<' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(270): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(270): error C2238: unexpected token(s) preceding ';' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(271): error C2143: syntax error : missing ';' before '<' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(271): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(271): error C2238: unexpected token(s) preceding ';' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(272): error C2143: syntax error : missing ';' before '<' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(272): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(272): error C2238: unexpected token(s) preceding ';' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(274): error C2143: syntax error : missing ';' before '<' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(274): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(274): error C2238: unexpected token(s) preceding ';' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(276): error C2143: syntax error : missing ';' before '<' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(276): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(276): error C2238: unexpected token(s) preceding ';' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(277): error C2143: syntax error : missing ';' before '<' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(277): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(277): error C2238: unexpected token(s) preceding ';' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(278): error C2143: syntax error : missing ';' before '<' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(278): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(278): error C2238: unexpected token(s) preceding ';' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(254): error C2065: 'filter2D' : undeclared identifier 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(286): error C2065: 'InputArray' : undeclared identifier 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(286): error C2146: syntax error : missing ')' before identifier 'kernel' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(286): error C2059: syntax error : ')' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(289): error C2143: syntax error : missing ';' before '<' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(289): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(294): error C2143: syntax error : missing ';' before '<' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(294): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(294): error C2086: 'int cv::Ptr' : redefinition 1> D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(289) : see declaration of 'cv::Ptr' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(300): error C2143: syntax error : missing ';' before '<' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(300): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(300): error C2086: 'int cv::Ptr' : redefinition 1> D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(289) : see declaration of 'cv::Ptr' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(306): error C2143: syntax error : missing ';' before '<' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(306): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(306): error C2086: 'int cv::Ptr' : redefinition 1> D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(289) : see declaration of 'cv::Ptr' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(314): error C2143: syntax error : missing ';' before '<' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(314): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(314): error C2086: 'int cv::Ptr' : redefinition 1> D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(289) : see declaration of 'cv::Ptr' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(320): error C2146: syntax error : missing ';' before identifier 'getGaussianKernel' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(320): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(323): error C2143: syntax error : missing ';' before '<' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(323): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(323): error C2086: 'int cv::Ptr' : redefinition 1> D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(289) : see declaration of 'cv::Ptr' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(327): error C2065: 'OutputArray' : undeclared identifier 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(327): error C2146: syntax error : missing ')' before identifier 'kx' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(327): error C2182: 'getDerivKernels' : illegal use of type 'void' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(329): error C2059: syntax error : ')' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(331): error C2143: syntax error : missing ';' before '<' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(331): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(331): error C2086: 'int cv::Ptr' : redefinition 1> D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(289) : see declaration of 'cv::Ptr' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(335): error C2143: syntax error : missing ';' before '<' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(335): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(335): error C2086: 'int cv::Ptr' : redefinition 1> D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(289) : see declaration of 'cv::Ptr' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(338): error C2143: syntax error : missing ';' before '<' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(338): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(338): error C2086: 'int cv::Ptr' : redefinition 1> D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(289) : see declaration of 'cv::Ptr' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(342): error C2143: syntax error : missing ';' before '<' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(342): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(342): error C2086: 'int cv::Ptr' : redefinition 1> D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(289) : see declaration of 'cv::Ptr' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(348): error C2146: syntax error : missing ';' before identifier 'getGaborKernel' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(348): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(348): error C2086: 'int cv::Mat' : redefinition 1> D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(320) : see declaration of 'cv::Mat' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(348): error C2065: 'Size' : undeclared identifier 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(348): error C2146: syntax error : missing ')' before identifier 'ksize' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(349): error C2059: syntax error : ')' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(358): error C2143: syntax error : missing ';' before '<' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(358): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(358): error C2086: 'int cv::Ptr' : redefinition 1> D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(289) : see declaration of 'cv::Ptr' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(360): error C2143: syntax error : missing ';' before '<' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(360): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(360): error C2086: 'int cv::Ptr' : redefinition 1> D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(289) : see declaration of 'cv::Ptr' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(362): error C2143: syntax error : missing ';' before '<' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(362): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(362): error C2086: 'int cv::Ptr' : redefinition 1> D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(289) : see declaration of 'cv::Ptr' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(366): error C2146: syntax error : missing ';' before identifier 'morphologyDefaultBorderValue' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(366): error C2433: 'Scalar' : 'inline' not permitted on data declarations 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(366): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(366): error C2825: 'cv::Scalar': must be a class or namespace when followed by '::' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(366): error C2039: 'all' : is not a member of 'global namespace'' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(366): error C2146: syntax error : missing ';' before identifier 'all' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(366): error C3861: 'all': identifier not found 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(369): error C2143: syntax error : missing ';' before '<' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(369): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(369): error C2086: 'int cv::Ptr' : redefinition 1> D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(289) : see declaration of 'cv::Ptr' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(377): error C2146: syntax error : missing ';' before identifier 'getStructuringElement' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(377): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(377): error C2086: 'int cv::Mat' : redefinition 1> D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(320) : see declaration of 'cv::Mat' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(377): error C2061: syntax error : identifier 'Size' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(379): error C2143: syntax error : missing ';' before '<' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(379): error C2182: 'Ptr' : illegal use of type 'void' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(379): error C2086: 'int cv::Ptr' : redefinition 1> D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(289) : see declaration of 'cv::Ptr' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(379): error C2988: unrecognizable template declaration/definition 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(379): error C2059: syntax error : '<' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(379): error C2039: 'delete_obj' : is not a member of 'global namespace'' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(387): error C2065: 'InputArray' : undeclared identifier 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(387): error C2146: syntax error : missing ')' before identifier 'src' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(387): error C2182: 'medianBlur' : illegal use of type 'void' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(387): error C2059: syntax error : ')' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(389): error C2065: 'InputArray' : undeclared identifier 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(389): error C2146: syntax error : missing ')' before identifier 'src' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(389): error C2182: 'GaussianBlur' : illegal use of type 'void' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(392): error C2059: syntax error : ')' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(394): error C2065: 'InputArray' : undeclared identifier 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(394): error C2146: syntax error : missing ')' before identifier 'src' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(394): error C2182: 'bilateralFilter' : illegal use of type 'void' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(396): error C2059: syntax error : ')' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(398): error C2065: 'InputArray' : undeclared identifier 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(398): error C2146: syntax error : missing ')' before identifier 'src' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(398): error C2182: 'adaptiveBilateralFilter' : illegal use of type 'void' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(400): error C2059: syntax error : ')' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(400): fatal error C1003: error count exceeds 100; stopping compilation ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


ERROR SCREENSHOT

WikiMalik
  • 21
  • 1
  • 8
  • "Download OpenCV 2.4.8 ( but I'm using version 2413]" -- HUH? – Dan Mašek Dec 03 '16 at 15:22
  • Anything man, I'm willing to try it cause I'm new. But how does that justify that my OpenCV 2.4.1.3 version initially worked? – WikiMalik Dec 03 '16 at 15:41
  • #include – Miki Dec 03 '16 at 15:41
  • Should the version number even make a difference here? I just opened the download page for OpenCV http://opencv.org/downloads.html and v2.4.8 is nowhere to be found. What should I do now? – WikiMalik Dec 03 '16 at 15:44
  • @DanMašek I appreciate your comment, please help me get there. – WikiMalik Dec 03 '16 at 15:45
  • @Miki Just did, still the same error as you see in the screenshot. – WikiMalik Dec 03 '16 at 15:48
  • @WikiMalik 2.4.13 is fine, might as well use a recent version. However, the entire question talks about 2.4.8, especially all the .lib files still have `248` in the name, rather than `2413`. That's bit misleading. – Dan Mašek Dec 03 '16 at 15:49
  • @DanMašek I changed the 248 to 2413 for both Debug and Release. I have checked it like 20 times. I wish it were the problem. – WikiMalik Dec 03 '16 at 15:52
  • Is there more info I can provide that could help? – WikiMalik Dec 03 '16 at 15:54
  • @Miki Surely that should not be needed, unless `highgui.hpp` doesn't include all it uses (which I would consider a pretty bad bug). As shown, that code sample builds fine for me on VS2013, so that's not the case. – Dan Mašek Dec 03 '16 at 15:58
  • @WikiMalik My point was that big parts of your question say you did A, but in fact you did B. Anyway, bad lib names wouldn't cause compile errors. Rather than a screenshot of the error list (and lots of other stuff), attach the text from the "Output" window. – Dan Mašek Dec 03 '16 at 16:06
  • @DanMašek Okay, tried to add it to the main thread but I really have a bad reputation. here's the link to the text file. https://drive.google.com/file/d/0B_wIR1AsbUQvWnhLWnhyYU1TbE0/view?usp=sharing – WikiMalik Dec 03 '16 at 16:14

2 Answers2

1

It's a compiler error (not a linker error) so it should have to do with the header files, I guess. Haven't you installed different versions of OpenCV on the same place? That would mix up the things. Try delete all the opencv files and start over again.

hiroki
  • 381
  • 1
  • 7
  • No, there is no other version of OpenCV installed on my computer. Two facts keep bugging me. 1. Why was it working before and now it's not (after I included imgproc in my code, which later removing isn't doing any better)? 2. Why is error log saying that the error is in the imgproc library? It's been two days, I'm still scratching my head over the problem. Can do you know someone who can help me? I really appreciate your answer and I'd love to find the one that finally solves my problem. – WikiMalik Dec 04 '16 at 11:28
  • 1
    Are you sure you didn't mistakenly modify the opencv header file? Check around the first error (imgproc.hpp(141)) to see if there's anything strange. Or, check the file timestamp. – hiroki Dec 04 '16 at 12:00
  • I created another project using the same configuration, still the same error. Had it been the header file issue, it should have been gone. But I'm all ears, if you think you are onto something, just tell me the step-wise instruction and I swear I will follow it without any questions. – WikiMalik Dec 04 '16 at 12:14
  • Creating a new visual studio project won't clean up opencv header files. Please check imgproc.hpp and find what exactly is causing the syntax error. Then you will be getting close to the problem. – hiroki Dec 04 '16 at 12:21
  • Great, let's focus on that. The problem is I won't be able to understand the error, the output log is right there and I am completely new to OpenCV and visual studio. (Java, HTML, C# would have been my thing) Tell me what you need, file, text, anything... I'll update it on the thread or create a temporary blog for you to read. – WikiMalik Dec 04 '16 at 12:32
  • Can you replace the first line with – hiroki Dec 04 '16 at 13:05
  • Can you replace the first line with `#include ` ? – hiroki Dec 04 '16 at 13:06
  • Didn't you delete `#include "stdafx.h"` generated automatically by visual studio ? This is necessary to be in the very first line for every .cpp files with precompiled header enabled, which is the default. And missing this might have caused your problem. – hiroki Dec 04 '16 at 15:32
  • I didn't delete any file of the project if that's what you are pointing to. Or did to mean I have to include it in the code? I did that to due to my desperation... no result? – WikiMalik Dec 04 '16 at 20:30
  • From this forum, Patrizio Bertonis' answer looks like the exact problem I get when I turn on: Configuration Properties -> C/C++ -> Preprocessor -> Preprocess to a File (as instructed by Nikita.. A linker error, you might be familar with?) http://stackoverflow.com/questions/133698/why-does-fatal-error-lnk1104-cannot-open-file-c-program-obj-occur-when-i-c – WikiMalik Dec 04 '16 at 20:31
  • When you create a win32 console app, it should look like this.`// ConsoleApplication1.cpp : Defines the entry point for the console application. // #include "stdafx.h" int _tmain(int argc, _TCHAR* argv[]) { return 0; } ` – hiroki Dec 05 '16 at 01:57
  • Sorry for the broken text but I still don't know how to write a comment with line breaks. Anyway, `#include "stdafx.h"` is really vital part of the project. This defines all the necessary macros and symbols for preprocessors. – hiroki Dec 05 '16 at 01:59
1

In project options (3.3) you only need the following additional include:

$opencv\build\include

D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(141): error C2146: syntax error : missing ';' before identifier 'ksize' 1>D:\OpenCV\opencv\build\include\opencv2\imgproc\imgproc.hpp(141): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

Error caused by missed declaration of Size which is declared in "opencv2/core/core.hpp" header. Other types like InputArray, OutputArray also declared there. core.hpp is included together with #include <opencv2\highgui\highgui.hpp>. Check that core.hpp is not broken (e.g. not empty).

If you use Visual Studio 2012 Ultimate you can generate include graph and check where imgproc.hpp included. For the program above it should looks like on the picture bellow:

enter image description here

As you can see, imgproc.hpp header is not included automatically. To fix the error you should find where imgproc.hpp is included. I suggest to check the preprocessor output for the Source.cpp file. To do it follow the instructions here. Look through the result Source.i file and find where imgproc.hpp included.

UPDATE:

In your Source.i the following lines includes imgproc.hpp:

#line 2 "d:\\program files (x86)\\microsoft visual studio 11.0\\vc\\include\\iosfwd"
#line 1 "d:\\opencv\\opencv\\build\\include\\opencv2\\imgproc\\imgproc.hpp"

these lines come from the standard headers includes in #include "opencv2/core/core.hpp". I don't know why this random header included there.

It looks like there is a magic to disable standard headers include. Define SKIP_INCLUDES in your preprocessor definitions. In Solution Explorer opens Project Properties -> C\C++ -> Preprocessor -> Preprocessor Definitions and add SKIP_INCLUDES there.

Nikita
  • 6,270
  • 2
  • 24
  • 37
  • Also you can post link to `Source.i` here and I will check it. – Nikita Dec 04 '16 at 13:13
  • Following your instructions, 1. Additional Include now only has: D:\OpenCV\opencv\build\include 2. I checked the core.hpp, the file is about 186kb, so I think it's not empty. – WikiMalik Dec 04 '16 at 14:44
  • 3. I don't have VS 2012 Ultimate, so I can't generate include graph, but I could get Ultimate if you recommend it. 4. Your last para got a little too techy for me, I followed your recommended link, but it wasn't fully clear. I could only get as far as this >> http://opencvtesting101.blogspot.com/2016/12/how-to-generate-preprocessor-output.html – WikiMalik Dec 04 '16 at 14:44
  • 5. So if I think the purpose is to check imgproc.hpp's header, it should show in the included files. So I followed these >> http://stackoverflow.com/questions/1137966/displaying-the-include-hierarchy-for-a-c-file-in-visual-studio << instructions to get the list of included files and headers >> http://opencvtesting101.blogspot.com/2016/12/included-files-and-headers.html (tried to update it on the main thread but we have already exaggerate wordcount limit, please ignore my noodledom and thanks for help, I appreciate it.) – WikiMalik Dec 04 '16 at 14:44
  • If step 5. didn't help, please help me a bit with step 4. I am trying my best here to make sure I search and try before asking you more questions. – WikiMalik Dec 04 '16 at 14:46
  • @WikiMalik Purpose of retrieving of `Source.i` is to understand who includes `imgproc.hpp` header. Steps to get this preprocessed file is simple: 1) In Solution Explorer open context menu for `Source.cpp` file and select Properties; 2) Than change `C/C++ -> Preprocessor -> Preprocess to a File -> Yes`. 3) Once again open context menu for `Source.cpp` and click `Compile`. 4) Result file `Source.i` will be in intermediate folder "x64\Debug" or something like that. – Nikita Dec 04 '16 at 14:56
  • Thanks for guiding me through the process, here's the link to source.i file that was generated in the Solution\Project\Debug folder. https://drive.google.com/file/d/0B_wIR1AsbUQvMTdka2tMWDNQOUU/view?usp=sharing – WikiMalik Dec 04 '16 at 19:55
  • While I do believe it's way above me, I'll also try to put my finger on the file in the light of your explanation of the error. Thanks again. BTW I have changed all the configurations to x86 just to experiment with it, but if I have an x64 backup of the project so that won't be a problem. – WikiMalik Dec 04 '16 at 19:58
  • Update: Turning On: Preprocessor -> Preprocess to a File changes the error to LNK1104 error>Line 1. – WikiMalik Dec 04 '16 at 20:58
  • @WikiMalik Right, Proprocessor output is required only to understand what is going on during compilation. Please disable it and try to apply workaround from my updated answer. – Nikita Dec 04 '16 at 21:01
  • I did disable it and added SKIP_INCLUDES. Looks like this now: WIN32;_DEBUG;_CONSOLE;SKIP_INCLUDES;%(PreprocessorDefinitions). And Now have a whole new list of errors :( Starting with Error 122 error C1003: error count exceeds 100; stopping compilation D:\OpenCV\opencv\build\include\opencv2\core\core.hpp 2953 1 OpenCVI What should I do now? – WikiMalik Dec 04 '16 at 21:12
  • @WikiMalik Could you please post several of them? – Nikita Dec 04 '16 at 21:15
  • I know it's terrifying and nerve breaking trying to help someone in the limited information (Like over phone). You literally have to be wired in; I'm open to skype screen share, TeamViewer etc) if that's a possible option. – WikiMalik Dec 04 '16 at 21:15
  • Output and Errors: http://opencvtesting101.blogspot.com/2016/12/output-after-skipincludes.html – WikiMalik Dec 04 '16 at 21:20
  • @WikiMalik Send me please your complete solution. Looks like you have broken project templates or something wrong with Visual Studio. I saw such strange behavior after update from Win 7 to Win 10 – Nikita Dec 04 '16 at 21:28
  • Alright, here's the link to the Zip File: https://drive.google.com/open?id=0B_wIR1AsbUQvZUxGV1hRb1NCeG8 – WikiMalik Dec 04 '16 at 21:33
  • @WikiMalik In `Main.cpp` try to include only the following headers: `#include `, `#include `, `#include `, `#include `, `#include `, `#include `, `#include`. Header order should be preserved. – Nikita Dec 04 '16 at 21:47
  • I did, preserving the order, and now I have 224 Errors. Did the project compiled alright on your end? – WikiMalik Dec 04 '16 at 21:59
  • @WikiMalik Yes, it's compiled properly. Probably, you could try to reinstall your Visual Studio, as I think it is the reason of the problem. – Nikita Dec 04 '16 at 22:12
  • Could you look at the errors once more for me before giving up, afterward, I'll accept my doom. http://opencvtesting101.blogspot.com/2016/12/output-errors-after-including-headers.html – WikiMalik Dec 04 '16 at 22:14
  • Actually, I have switched between VS 2010, VS 2011, VS 2012 just to get OpenCV working. I got happy when v2012 did compiled at the first time and I finally got to see a picture display, same code, same configuration as was shown in the tutorial. And then I included imgproc, which became the mother of all issues. – WikiMalik Dec 04 '16 at 22:16
  • @WikiMalik Yes, strange errors still there. E.g. `error C2039: 'vector' : is not a member of 'std'`, but it's explicitly included by `#include `. – Nikita Dec 04 '16 at 22:18
  • I'm a writer basically, doing this for experimental purposes. I need to make a library that I wanna eventually ship to Unity3D where I'm more familiar with working framework of 3D and javascript. If you have any opinion in that regard, that'll also be helpful, but I really need to a platform tell the machines something and learn something in return. – WikiMalik Dec 04 '16 at 22:21