c++ - collect2.exe:错误:ld 返回 1 退出状态窗口 7 SE
问题描述
我在我的 Windows 7 笔记本电脑上按照这个论坛安装了 CMake、OpenCV 。当我尝试构建主代码时,我得到了这个错误:collect2.exe: error: ld returned 1 exit status
这是我的代码:
/**
@file videocapture_basic.cpp
@brief A very basic sample for using VideoCapture and VideoWriter
@author PkLab.net
@date Aug 24, 2016
*/
#include <opencv2/core.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/highgui.hpp>
#include <iostream>
#include <stdio.h>
using namespace std;
using namespace cv;
int main()
{
Mat frame;
//--- INITIALIZE VIDEOCAPTURE
VideoCapture cap;
// open the default camera using default API
// cap.open(0);
// OR advance usage: select any API backend
int deviceID = 0; // 0 = open default camera
int apiID = cv::CAP_ANY; // 0 = autodetect default API
// open selected camera using selected API
cap.open(deviceID, apiID);
// check if we succeeded
if (!cap.isOpened()) {
cerr << "ERROR! Unable to open camera\n";
return -1;
}
//--- GRAB AND WRITE LOOP
cout << "Start grabbing" << endl
<< "Press any key to terminate" << endl;
for (;;)
{
// wait for a new frame from camera and store it into 'frame'
cap.read(frame);
// check if we succeeded
if (frame.empty()) {
cerr << "ERROR! blank frame grabbed\n";
break;
}
// show live and wait for a key with timeout long enough to show images
imshow("Live", frame);
if (waitKey(5) >= 0)
break;
}
// the camera will be deinitialized automatically in VideoCapture destructor
return 0;
}
这是构建日志中的错误:
C:\opencv_install\install\x64\mingw\lib\OpenCVConfig.cmake: file not recognized: File format not recognized
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 1 second(s))
1 error(s), 0 warning(s) (0 minute(s), 1 second(s))
这是构建消息中的错误: 构建消息
我看了很多论坛,但没有找到我的错误的回应。请问你能帮我吗?
解决方案
推荐阅读
- javascript - 有没有办法在 CouchDB 中过滤子文档?
- python - 在 aiohttp 客户端响应中访问完整的请求信息
- python - 如何使用 Python 将数组转换为二进制值?
- c# - '违反了多重性约束。关系 Rayon_Produits' 的角色 'Rayon_Produits_Source' 具有多重性 1 或 0..1。
- image - Flutter:如何在每个图像上放置按钮(x)以取消选定的图像
- sql - 如何在多对多关系中获取不存在的行
- cmake - 在 CMake 中使用空字符串设置缓存变量有什么意义?
- api - 根据 Yii2 中的字段获取数据
- javascript - 刷新页面后如何阻止 CSS 样式表重置为默认值?
- python - 无法找到可运行的浏览器(尝试使用 webbrowser 单击按钮)