Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

facedetection_export.h这是个什么东西0.0 #222

Open
SiyerBOBO opened this issue Mar 17, 2020 · 8 comments
Open

facedetection_export.h这是个什么东西0.0 #222

SiyerBOBO opened this issue Mar 17, 2020 · 8 comments

Comments

@SiyerBOBO
Copy link

facedetectcnn.h在这个头文件中包含了facedetection_export.h库,但是在您的源码根目录中我没有找到它,烦请解释一下,谢谢

@ShiqiYu
Copy link
Owner

ShiqiYu commented Mar 17, 2020

You can remove that line.

@KangLin Can you help to explain?

@SiyerBOBO
Copy link
Author

Thank you~(^-^)I can now compile it normally

@infrontofme
Copy link

@SiyerBOBO 您好请教一下,我运行程序,遇到这个问题,“facedetect_cnn”: 找不到标识符,您知道是什么原因吗?

@zhuth
Copy link

zhuth commented Mar 24, 2020

facedetection_export.h 是运行cmake之后产生出来的,包含了一些选项,包括是否使用AVX2、AVX512指令集等等。
如果是用编译好的 shared library(动态链接库),找不到标识符可能是因为facedetect_cnn函数定义前没加上extern "C"。
我C++不熟,如有说错的还请指正。

@KangLin
Copy link
Contributor

KangLin commented Mar 24, 2020

1、facedetection_export.h 是运行cmake之后产生出来的,主要是针对 windows DLL 导出函数。它申明了 FACEDETECTION_EXPORT 。
2、windows dll 导出函数需要 __declspec(dllexport) 声明,只有声明后,函数才会从DLL中导出,未声明的函数,做为DLL的私有函数,是不会从DLL中导出的(你可以把DLL看成class, __declspec(dllexport) 看成 public) 。当其它程序引用时,需要 __declspec(dllimport) 声明。
3、extern "C" 是用来指示C++函数编译时,用C格式修饰。 C++ 与 C 语言在编译时,函数修饰的格式是不一样的,为了能使C语言调用C++函数,所以需要加extern "C"

@KangLin
Copy link
Contributor

KangLin commented Mar 24, 2020

我建议使用库的形式使用本项目,不要使用源码形式。当你需要在其它项目中以源码形式使用 libfacedectection 时,需要定义 FACEDETECTION_EXPORT 宏:你可以使用下列方法之一:
1、先编译本项目,然后把生成的 facedetection_export.h 和源码一起复制到其它项目。
2、增加 facedetection_export.h 文件,在其中定义宏 FACEDETECTION_EXPORT
#define FACEDETECTION_EXPORT

KangLin added a commit to KangLin/libfacedetection that referenced this issue Mar 24, 2020
KangLin added a commit to KangLin/libfacedetection that referenced this issue Mar 24, 2020
KangLin added a commit to KangLin/libfacedetection that referenced this issue Mar 24, 2020
KangLin added a commit to KangLin/libfacedetection that referenced this issue Mar 24, 2020
ShiqiYu added a commit that referenced this issue Mar 26, 2020
@nminhchau
Copy link

Hi everyone, I can't find facedetection_export.h here.
Please, can you help me find the file to compile and run it?

@KangLin
Copy link
Contributor

KangLin commented Jun 14, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants