OpenCV 4.5.2 Android in Visual Studio 2019

I too have this same problem. I will add that I tried it with OpenCV 3.4.14 (in addition to 4.5.2).

I also followed the same directions from the sites linked above (and was unable to find any other pages that talked about creating a .so through Visual Studios).

I found that the error goes away when no OpenCV header file is included, which of course defeats the purpose. I have very little C++ experience but I believe OpenCV must somewhere have its own “typedef __fp16 ???” line, because I can generate the error by adding to my code (after removing any OpenCV includes) my own typedef line. By adding

typedef __fp16 float16_t;

This is in fact what arm_neon.h is defining it as, and arm_neon.h is included as an External Dependency (I don’t know where the statement is that ultimately points to it so that it is included).

So I believe an OpenCV header file defines __fp16 as something and arm_neon.h also defines it as something (possibly the same thing, either way this error occurs).