REMOVEKEBAB
2020-03-20 21:19vs2017运行opencv相关代码时出现:
1>------ 已启动生成: 项目: App1, 配置: Debug x64 ------
1>App.xaml.cpp
1>e:\visual\app1\app1\app.xaml.cpp(20): warning C4447: 找到的“main”签名不带线程模型。请考虑使用“int main(Platform::ArrayPlatform::String^^ args)”。
1> 正在创建库 E:\visual\App1\x64\Debug\App1\App1.lib 和对象 E:\visual\App1\x64\Debug\App1\App1.exp
1>XamlTypeInfo.g.obj : error LNK2019: 无法解析的外部符号 "public: __cdecl App1::App::App(void)" (??0App@App1@@QE$AAA@XZ),该符号在函数 "public: void __cdecl ::operator()(class Windows::UI::Xaml::ApplicationInitializationCallbackParams ^)const " (??R@@QEBAXPE$AAVApplicationInitializationCallbackParams@Xaml@UI@Windows@@@Z) 中被引用
1>E:\visual\App1\x64\Debug\App1\App1.exe : fatal error LNK1120: 1 个无法解析的外部命令
1>已完成生成项目“App1.vcxproj”的操作 - 失败。
========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========
========== 部署: 成功 0 个,失败 0 个,跳过 0 个 ==========
错误 LNK1120 1 个无法解析的外部命令 App1 E:\visual\App1\x64\Debug\App1\App1.exe 1
我的代码是:
#include
#include
#include
using namespace std;
//opencv头文件
#include "D:/OpenCV/opencv/opencv/build/include/opencv2/core/core.hpp"
#include "D:/OpenCV/opencv/opencv/build/include/opencv2/highgui/highgui.hpp"
using namespace cv;
//OPENCV命令行解析器函数
//命令行解析
const char*keys =
{
"{help h usage ? || print this message}"
"{@video|| Video file,if not defined try to ues webcamera}"
};
int main(int argc,const char**argv)
{
CommandLineParser parser(argc, argv, keys);
parser.about("Chapter 2.v1.0.0");
//如果需要,选择帮助文档
if (parser.has("help"))
{
parser.printMessage();
return 0;
}
string videoFile = parser.get(0);
//分析params的,检查params是否正确
if (!parser.check())
{
parser.printErrors();
return 0;
}
VideoCapture cap;//打开默认相机
if (videoFile != "")
cap.open(videoFile);
else
cap.open(0);
if (!cap.isOpened())//检查是否成功了
return -1;
namedWindow("Video", 1);
for (;;)
{
Mat frame;
cap >> frame;//获取摄像机的帧
imshow("Video", frame);
if (waitKey(30) >= 0) break;
}
//释放的摄像机或视频cap
cap.release();
return 0;
}
球球大家了
- 点赞
- 回答
- 收藏
- 复制链接分享
1条回答
为你推荐
- Opencv中的imshow函数不显示窗口?
- github
- linux
- c++
- visual studio
- 3个回答
- 从PHP运行Python openCV代码无法正常工作
- python
- opencv
- php
- 1个回答
- 在服务器(windows server2012 R2 Standard)上读取视频cap.read()占用内存特别大,怎么解决?
- python
- 机器学习
- 1个回答
- c#调用c++相机标定程序报错debug error abort()has been called,exe可单独运行
- c++
- c#
- 1个回答
- opencv3.4.3配置 opencv contrib后,无法读取opencv_aruco343d.dll,怎么解决?
- opencv contrib
- opencv3.4.3
- 1个回答