首页 技术 正文
技术 2022年11月15日
0 收藏 500 点赞 4,471 浏览 945 个字
  1. #define FaceLIBDLL
  2. #include “stdafx.h”
  3. #include “facedll.h”
  4. #include <opencv2/opencv.hpp>
  5. //////////头文件中函数的实现
  6. FaceRecognizer::FaceRecognizer()
  7. {
  8. }
  9. FaceRecognizer::~FaceRecognizer()
  10. {
  11. }

生成(Build)工程,在debug文件夹中会生成相应的DLL及LIB文件:facedll.dll   facedll.lib

多个类封装DLL

封装好一个类之后,在后面的类可以调用这个类生成的dll,再封装新类的dll。

需要在工程中添加需要引用的头文件,如facedll.h。在debug中拷贝facedll.lib文件。在 Properties->Linker->Input->  Additional Dependecies中添加facedll.lib(或写全路径:”..\debug\facedll.lib”)

然后一样的方法再封装新的类就可以了~

  1. #pragma once
  2. #ifdef HEARTLIBDLL
  3. #define HEARTAPI _declspec(dllexport)
  4. #else
  5. #define HEARTAPI  _declspec(dllimport)
  6. #endif
  7. #include <opencv2/opencv.hpp>
  8. #include “facedll.h”
  9. #include “datadll.h”
  10. class HEARTAPI  HRMeasure
  11. {
  12. };

调用DLL

调用需要各个dll的.h、.dll、.lib文件。将头文件添加到工程中,并#include到需要用的地方。将lib文件拷贝到项目中,并在 Properties->Linker->Input->  Additional Dependecies 中写入:facedll.lib;heartdll.lib。或者在程序中写入:

  1. #pragma  comment(lib,”facedll.lib”)
  2. #pragma  comment(lib,”heartdll.lib”)

之后程序中就可以直接使用封装成DLL的类了:

  1. HRMeasure *hrMea=new HRMeasure();
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,107
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,583
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,430
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,201
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,836
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,919