”标记之前应该有主表达式 D:/opencv/build/include/opencv2/core/operations.hpp:3972:错误:在“')标记之前应该有主表达式 D:/opencv/build/include/opencv2/core/operations.hpp:在全局范围内: D:/opencv/build/include/opencv2/core/operations.hpp:4024:错误:为'void cv::AlgorithmInfo::addParam(cv::Algorithm&,const char*,cv::Ptr&,bool,cv::Ptr(cv::Algorithm::*)(),void(cv::Algorithm:::*)(const cv::Ptr&),const std::string&')获取了2个模板参数 D:/opencv/build/include/opencv2/core/operations.hpp:4024:错误:但需要1 D:/opencv/build/include/opencv2/core/operations.hpp:4033:错误:重新定义'void cv::AlgorithmInfo::addParam(cv::Algorithm&,const char*,cv::Ptr&,bool,cv::Ptr(cv::Algorithm::*)(),void(cv::Algorithm:::*)(const cv::Ptr&),const std::string&' D:/opencv/build/include/opencv2/core/operations.hpp:4024:error:`void cv::AlgorithmInfo::addParam(cv::Algorithm&,const char*,cv::Ptr&,bool,cv::Ptr(cv::Algorithm:*)(),void(cv::Algorithm::*)(const cv::Ptr&),const std::string&'),前面在这里声明,c++,opencv,dev-c++,C++,Opencv,Dev C++" /> ”标记之前应该有主表达式 D:/opencv/build/include/opencv2/core/operations.hpp:3972:错误:在“')标记之前应该有主表达式 D:/opencv/build/include/opencv2/core/operations.hpp:在全局范围内: D:/opencv/build/include/opencv2/core/operations.hpp:4024:错误:为'void cv::AlgorithmInfo::addParam(cv::Algorithm&,const char*,cv::Ptr&,bool,cv::Ptr(cv::Algorithm::*)(),void(cv::Algorithm:::*)(const cv::Ptr&),const std::string&')获取了2个模板参数 D:/opencv/build/include/opencv2/core/operations.hpp:4024:错误:但需要1 D:/opencv/build/include/opencv2/core/operations.hpp:4033:错误:重新定义'void cv::AlgorithmInfo::addParam(cv::Algorithm&,const char*,cv::Ptr&,bool,cv::Ptr(cv::Algorithm::*)(),void(cv::Algorithm:::*)(const cv::Ptr&),const std::string&' D:/opencv/build/include/opencv2/core/operations.hpp:4024:error:`void cv::AlgorithmInfo::addParam(cv::Algorithm&,const char*,cv::Ptr&,bool,cv::Ptr(cv::Algorithm:*)(),void(cv::Algorithm::*)(const cv::Ptr&),const std::string&'),前面在这里声明,c++,opencv,dev-c++,C++,Opencv,Dev C++" />

开发C++;使用OpenCV编译错误 我使用DEV C++ 4.92.2和OpenCV 2.4.8,我也在Windows 7 x86中。这些是在我的编译器设置中,-L“D:\opencv\build\x86\vc12\bin“-lopencv\u highgui248-lopencv\u core248-lopencv\u flann248-lopencv\u gpu248-lopencv\u imgproc248-lopencv\u ml248-lopencv\u nonfree248-lopencv\u objdetect248-lopencv-photo248-lopencv\u video248-lopencv\u ts248.每次我编译我的简单项目时,它显示以下错误:编译器: OpenCV Executing g++.exe... g++.exe "D:\VS Projects\WebCam\WebCam\loadimg.cpp" -o "D:\VS Projects\WebCam\WebCam\loadimg.exe" -g3 -I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\Dev-Cpp\include\c++\3.4.2" -I"C:\Dev-Cpp\include" -I"D:\opencv\build\include\opencv2" -I"D:\opencv\build\include" -L"C:\Dev-Cpp\lib" -L"D:\opencv\build\x86\vc12\lib" -g3 In file included from D:/opencv/build/include/opencv2/core/core.hpp:4854, from D:/opencv/build/include/opencv2/opencv.hpp:47, from D:\VS Projects\WebCam\WebCam\loadimg.cpp:1: D:/opencv/build/include/opencv2/core/operations.hpp: In static member function `static cv::Ptr<_Tp2> cv::Algorithm::create(const std::string&)': D:/opencv/build/include/opencv2/core/operations.hpp:3972: error: expected primary-expression before '>' token D:/opencv/build/include/opencv2/core/operations.hpp:3972: error: expected primary-expression before ')' token D:/opencv/build/include/opencv2/core/operations.hpp: At global scope: D:/opencv/build/include/opencv2/core/operations.hpp:4024: error: got 2 template parameters for `void cv::AlgorithmInfo::addParam(cv::Algorithm&, const char*, cv::Ptr<_Tp2>&, bool, cv::Ptr<_Tp2> (cv::Algorithm::*)(), void (cv::Algorithm::*)(const cv::Ptr<_Tp2>&), const std::string&)' D:/opencv/build/include/opencv2/core/operations.hpp:4024: error: but 1 required D:/opencv/build/include/opencv2/core/operations.hpp:4033: error: redefinition of `void cv::AlgorithmInfo::addParam(cv::Algorithm&, const char*, cv::Ptr<_Tp2>&, bool, cv::Ptr<_Tp2> (cv::Algorithm::*)(), void (cv::Algorithm::*)(const cv::Ptr<_Tp2>&), const std::string&)' D:/opencv/build/include/opencv2/core/operations.hpp:4024: error: `void cv::AlgorithmInfo::addParam(cv::Algorithm&, const char*, cv::Ptr<_Tp2>&, bool, cv::Ptr<_Tp2> (cv::Algorithm::*)(), void (cv::Algorithm::*)(const cv::Ptr<_Tp2>&), const std::string&)' previously declared here OpenCV 正在执行g++.exe。。。 g++.exe“D:\VS Projects\WebCam\WebCam\loadimg.cpp”-o“D:\VS Projects\WebCam\WebCam\loadimg.exe”-g3-I“C:\Dev cpp\lib\gcc\mingw32\3.4.2\include”-I“C:\Dev cpp\include\C++\3.4.2\backward”-I“C:\Dev cpp\include\include\C++\3.4.2\mingw32”-I“C:\Dev cpp\include\C++\3.4.2”-C:\Dev cpp\include\include\openi”C:\cpp\include\openi“D:\opencv\build\include“-L”C:\Dev Cpp\lib“-L”D:\opencv\build\x86\vc12\lib“-g3 在D:/opencv/build/include/opencv2/core/core.hpp:4854中包含的文件中, 从D:/opencv/build/include/opencv2/opencv.hpp:47, 来自D:\VS Projects\WebCam\WebCam\loadimg.cpp:1: D:/opencv/build/include/opencv2/core/operations.hpp:在静态成员函数“static cv::Ptr cv::Algorithm::create(const std::string&)”中: D:/opencv/build/include/opencv2/core/operations.hpp:3972:错误:在“>”标记之前应该有主表达式 D:/opencv/build/include/opencv2/core/operations.hpp:3972:错误:在“')标记之前应该有主表达式 D:/opencv/build/include/opencv2/core/operations.hpp:在全局范围内: D:/opencv/build/include/opencv2/core/operations.hpp:4024:错误:为'void cv::AlgorithmInfo::addParam(cv::Algorithm&,const char*,cv::Ptr&,bool,cv::Ptr(cv::Algorithm::*)(),void(cv::Algorithm:::*)(const cv::Ptr&),const std::string&')获取了2个模板参数 D:/opencv/build/include/opencv2/core/operations.hpp:4024:错误:但需要1 D:/opencv/build/include/opencv2/core/operations.hpp:4033:错误:重新定义'void cv::AlgorithmInfo::addParam(cv::Algorithm&,const char*,cv::Ptr&,bool,cv::Ptr(cv::Algorithm::*)(),void(cv::Algorithm:::*)(const cv::Ptr&),const std::string&' D:/opencv/build/include/opencv2/core/operations.hpp:4024:error:`void cv::AlgorithmInfo::addParam(cv::Algorithm&,const char*,cv::Ptr&,bool,cv::Ptr(cv::Algorithm:*)(),void(cv::Algorithm::*)(const cv::Ptr&),const std::string&'),前面在这里声明

开发C++;使用OpenCV编译错误 我使用DEV C++ 4.92.2和OpenCV 2.4.8,我也在Windows 7 x86中。这些是在我的编译器设置中,-L“D:\opencv\build\x86\vc12\bin“-lopencv\u highgui248-lopencv\u core248-lopencv\u flann248-lopencv\u gpu248-lopencv\u imgproc248-lopencv\u ml248-lopencv\u nonfree248-lopencv\u objdetect248-lopencv-photo248-lopencv\u video248-lopencv\u ts248.每次我编译我的简单项目时,它显示以下错误:编译器: OpenCV Executing g++.exe... g++.exe "D:\VS Projects\WebCam\WebCam\loadimg.cpp" -o "D:\VS Projects\WebCam\WebCam\loadimg.exe" -g3 -I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\Dev-Cpp\include\c++\3.4.2" -I"C:\Dev-Cpp\include" -I"D:\opencv\build\include\opencv2" -I"D:\opencv\build\include" -L"C:\Dev-Cpp\lib" -L"D:\opencv\build\x86\vc12\lib" -g3 In file included from D:/opencv/build/include/opencv2/core/core.hpp:4854, from D:/opencv/build/include/opencv2/opencv.hpp:47, from D:\VS Projects\WebCam\WebCam\loadimg.cpp:1: D:/opencv/build/include/opencv2/core/operations.hpp: In static member function `static cv::Ptr<_Tp2> cv::Algorithm::create(const std::string&)': D:/opencv/build/include/opencv2/core/operations.hpp:3972: error: expected primary-expression before '>' token D:/opencv/build/include/opencv2/core/operations.hpp:3972: error: expected primary-expression before ')' token D:/opencv/build/include/opencv2/core/operations.hpp: At global scope: D:/opencv/build/include/opencv2/core/operations.hpp:4024: error: got 2 template parameters for `void cv::AlgorithmInfo::addParam(cv::Algorithm&, const char*, cv::Ptr<_Tp2>&, bool, cv::Ptr<_Tp2> (cv::Algorithm::*)(), void (cv::Algorithm::*)(const cv::Ptr<_Tp2>&), const std::string&)' D:/opencv/build/include/opencv2/core/operations.hpp:4024: error: but 1 required D:/opencv/build/include/opencv2/core/operations.hpp:4033: error: redefinition of `void cv::AlgorithmInfo::addParam(cv::Algorithm&, const char*, cv::Ptr<_Tp2>&, bool, cv::Ptr<_Tp2> (cv::Algorithm::*)(), void (cv::Algorithm::*)(const cv::Ptr<_Tp2>&), const std::string&)' D:/opencv/build/include/opencv2/core/operations.hpp:4024: error: `void cv::AlgorithmInfo::addParam(cv::Algorithm&, const char*, cv::Ptr<_Tp2>&, bool, cv::Ptr<_Tp2> (cv::Algorithm::*)(), void (cv::Algorithm::*)(const cv::Ptr<_Tp2>&), const std::string&)' previously declared here OpenCV 正在执行g++.exe。。。 g++.exe“D:\VS Projects\WebCam\WebCam\loadimg.cpp”-o“D:\VS Projects\WebCam\WebCam\loadimg.exe”-g3-I“C:\Dev cpp\lib\gcc\mingw32\3.4.2\include”-I“C:\Dev cpp\include\C++\3.4.2\backward”-I“C:\Dev cpp\include\include\C++\3.4.2\mingw32”-I“C:\Dev cpp\include\C++\3.4.2”-C:\Dev cpp\include\include\openi”C:\cpp\include\openi“D:\opencv\build\include“-L”C:\Dev Cpp\lib“-L”D:\opencv\build\x86\vc12\lib“-g3 在D:/opencv/build/include/opencv2/core/core.hpp:4854中包含的文件中, 从D:/opencv/build/include/opencv2/opencv.hpp:47, 来自D:\VS Projects\WebCam\WebCam\loadimg.cpp:1: D:/opencv/build/include/opencv2/core/operations.hpp:在静态成员函数“static cv::Ptr cv::Algorithm::create(const std::string&)”中: D:/opencv/build/include/opencv2/core/operations.hpp:3972:错误:在“>”标记之前应该有主表达式 D:/opencv/build/include/opencv2/core/operations.hpp:3972:错误:在“')标记之前应该有主表达式 D:/opencv/build/include/opencv2/core/operations.hpp:在全局范围内: D:/opencv/build/include/opencv2/core/operations.hpp:4024:错误:为'void cv::AlgorithmInfo::addParam(cv::Algorithm&,const char*,cv::Ptr&,bool,cv::Ptr(cv::Algorithm::*)(),void(cv::Algorithm:::*)(const cv::Ptr&),const std::string&')获取了2个模板参数 D:/opencv/build/include/opencv2/core/operations.hpp:4024:错误:但需要1 D:/opencv/build/include/opencv2/core/operations.hpp:4033:错误:重新定义'void cv::AlgorithmInfo::addParam(cv::Algorithm&,const char*,cv::Ptr&,bool,cv::Ptr(cv::Algorithm::*)(),void(cv::Algorithm:::*)(const cv::Ptr&),const std::string&' D:/opencv/build/include/opencv2/core/operations.hpp:4024:error:`void cv::AlgorithmInfo::addParam(cv::Algorithm&,const char*,cv::Ptr&,bool,cv::Ptr(cv::Algorithm:*)(),void(cv::Algorithm::*)(const cv::Ptr&),const std::string&'),前面在这里声明,c++,opencv,dev-c++,C++,Opencv,Dev C++,编辑: 这是我的密码 include <opencv2/opencv.hpp> #include <iostream> #include <io.h> using namespace cv; using namespace std; int main (int, char**) { cv::VideoCapture camera(1); if(!camera.isOpened()) { std::cerr << "ER

编辑: 这是我的密码

include <opencv2/opencv.hpp> 
#include <iostream>
#include <io.h>

using namespace cv;
using namespace std;

int main (int, char**) 
{
  cv::VideoCapture camera(1); 
  if(!camera.isOpened())
  {
    std::cerr << "ERROR: Could not open camera" << std::endl;
    return 1;
  }
  cv::namedWindow("Webcam", CV_WINDOW_AUTOSIZE);
  while(1)
  {
    cv::Mat frame;
    camera >> frame;
    cv::imshow("Webcam", frame);
    if (cv::waitKey(30) >= 0) 
    {
        imwrite("test.jpg", frame);
        break;
    }
  }
  return 0;
}
包括
#包括
#包括
使用名称空间cv;
使用名称空间std;
int main(int,char**)
{
cv::摄像机(1);
如果(!camera.isOpened())
{
标准:cerr框架;
cv::imshow(“网络摄像头”,框架);
如果(cv::waitKey(30)>=0)
{
imwrite(“test.jpg”,框架);
打破
}
}
返回0;
}
执行终止

你能帮我一下吗?拜托。
谢谢。

你能不能也发布你的代码?不要使用旧的标题。尝试只包含
。你可以让它工作。它仍然存在错误。我的编译器设置有问题吗?我发现两个问题:1)不要使用包含gcc:VS Projects的空格的路径,2)你尝试链接用h Visual Studio 2012:L“D:\opencv\build\x86\vc12\lib”-您尝试使用windows gcc端口构建应用程序,很可能是MinGW。我应该使用什么lib?我确实遵循了本教程[链接]