简体   繁体   中英

How can I convert an existing project with .c and .h files into a dynamic link library in visual studio 2019?

I am using the simple Open EtherCAT Master (SOEM) https://github.com/OpenEtherCATsociety/SOEM . I want to use the existing files in SOEM to create a .dll dynamic link library to build other projects with. I have tried creating a DLL in visual studio and simply uploading all the .c and .h files from SOEM to the DLL. When I do this, some of the header files are not recognized. Specifically the OSAL and OSHW header files. I'm not sure if this is a general issue between the header files or if this is an issue specific to the SOEM files. I would think that once you put all the .c and .h files in the same project, they would all be able to include each other.

Making the DLL:

  1. put all .c and .h files into dll project
  2. set directories to all files in solution properties > configuration properties > c/c++ > additional include directories
  3. add additional dependecies to libraries for wpcap and others (Ws2_32.lib, wpcap.lib, winmm.lib) solution properties > configuration properties > linker > input > additional dependecies
  4. set directories for wpcap libraries in solution properties > configuration properties > linker > general > additional library directories
  5. build was successful after step 4

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM