windows 动态库dll进行linux编译过程记录

2019-03-21  本文已影响0人  犭虫彳亍口苗

工具及环境

编译环境:windows 子linux系统(WSL)
工具:cmake

cmake安装及使用

cmake安装:https://www.linuxidc.com/Linux/2018-09/154165.html
cmake入门教程:https://www.cnblogs.com/ph829/p/4759124.html

过程

  1. 编写cmake,在WSL上编译linux动态库。
  2. 用vs2017新建linux工程,连接本地的WSL ,测试动态库。

备注

vs2017 无法识别linux的头文件

参考:https://stackoverflow.com/questions/43022494/linux-header-file-not-recognized-in-visual-studio-2017-linux-project

vs在连接远程linux系统后,会自动同步linux上的头文件。
但是新的连接方法,无法完全下载所有的头文件。所有需要改用旧的连接方法,步骤如下:


  1. Add remote connection.
    Tools->Options->Cross Platform->Connection Manager

  2. Select your connection Update from Tools->Options->Cross Platform->Connection Manager->Remote Headers Intellisense Manager. Next click on Explore button.


    image.png
  3. C:\Users[YourUser]\AppData\Local\Microsoft\Linux\HeaderCache\1.0[IdNumber] Rename the HeaderCache settings.xml.unused file to settings.xml


    image.png
  4. In the settings.xml file Change the syncMethod to sftp_ssh.


    image.png
  5. Update headers cache from Tools->Options->Cross Platform->Connection Manager->Remote Headers Intellisense Manager.

  6. Enjoy.


我服了,这种方法,不是特别了解vs的话,基本上是想不到。

上一篇 下一篇

猜你喜欢

热点阅读