Visual Studio + android + opencv 跨平台生成动态库文件

本文介绍了如何在VS2019中进行跨平台开发,为Android应用程序创建C++算法库,特别是涉及使用OpenCV的情况。详细步骤包括安装和配置VS2019,设置额外的包含目录和库目录,调整C++异常和运行时类型信息,并正确设置链接器选项。在编译过程中遇到的错误和解决方案也进行了讨论,包括库依赖项的正确添加方式。
摘要由CSDN通过智能技术生成

最近需要给安卓平台的应用程序提供c++开发的算法库,c++又用到了opencv开源库,不想使用Android Studio,用惯了VS,因此,写下VS跨平台开发安卓动态库的配置步骤。

 

参考链接:https://answers.opencv.org/question/179297/how-to-build-opencv-for-android-using-visual-studio/

https://blog.csdn.net/luoyu510183/article/details/94590497

 

官方说明文档(用于跨平台移动开发的 Visual C++):https://docs.microsoft.com/zh-cn/visualstudio/cross-platform/visual-cpp-for-cross-platform-mobile-development?view=vs-2017

(使用 C++ 安装跨平台移动开发)https://docs.microsoft.com/zh-cn/visualstudio/cross-platform/install-visual-cpp-for-cross-platform-mobile-development?view=vs-2017

 

 

第一步更改VS

选择更多-修改-工作负载-移动与游戏-使用c++的移动开发

选择安装,等待安装完成。

 

第二步配置VS:Setting up Visual Studio

  1. Create a new Visual Studio Project from "Visual C++/Cross Platform/Android" and choose the type of Project you want.
  2. Add the path "Path_to_build_folder/install/sdk/native/jni/include" to "Additional Include directories" and both the "native/3rdparty/libs/armeabi-v7a/" and "native/libs/armeabi-v7a/" to "Additional Library Directories".
  3. In your projects property dialog change "Enable C++ Exceptions" to "Yes (-fexceptions)" under "C/C++ - Code Generation" and "Enable Run-Time Type Information" to "Yes (-frtti)" as well. You can find it under "C/C++ - Language". Also add "-std=c++11" as Additional Option in the Command Line Section of "C/C++".
  4. In the Linker section of your property page, add "-lm -lz" to the command line additional options. This ensures correct linking.
  5. Under "Linker/Input", add all your built modules and also the 3rdparty libs as "Library Dependencies". Important: Only their names, e.g. not &
  • 1
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值