You have a compilation problem. If you create an ad-hoc project on Visual Studio, this will generate libraries and executables with the VS compiler in its output formats (Static library: .lib, Dynamic library: .dll, Executable: .exe)
Android is an operating system derived from GNU / Linux, the formats are different, so the compiler generates different output files (Static library: .a, Dynamic library: .so, Executable: .bin). Note: The files do not need to have. to work as if it is necessary in Windows.
As you rightly point out in your second question, what you need is to use CMake to generate these files. Since you are on a Windows computer, and your library has a different target (in this case Android), you need to use a TOOLCHAIN to be able to compile the source files with the output in the desired format. It is perfectly documented in the CMake reference . There is an Android toolchain in the network maintained by OpenCV here .
If you use CMake loading the toolchain, and you have written the source code with standard libraries, you should directly generate the files you need. If the compiler gives you an error, then you'll have to support both compilers with the source.