How can I build a library as a .dll and not a .lib

孤街浪徒 提交于 2021-01-27 06:32:16

问题


I got this c++ physics library liquidfun

Theyve included a visual studio solution for building the library for windows. When I build it it gives me a .lib but I want a .dll so I can use it with Unity3d. Is there a way of changing the build setting of a project in visual studio to get a .dll and not a .lib?

EDIT: The very simple fix of just changing it in the project properties actually worked for me! This is probably due to the library itself being really well written. It didnt work when I tried the same thing before I posted this question but that was caused by a problem with my c++ code


回答1:


Yes, you can generate a dll instead of a lib. To do this in VS right click on your project -> properties -> Configuration Properties -> General. In the "Project default" section go to "Configuration Type" and change it to "dynamic library .dll". Then do not forget to generate it ;)

PS : DLL, not >LIB of course ;)




回答2:


The easiest way is to build your VS solution from cmake.
I don't have the parameter at hand right now but cmake can list the parameters for you.
I think it was -DBUILD_SHARED_LIBS



来源:https://stackoverflow.com/questions/21407477/how-can-i-build-a-library-as-a-dll-and-not-a-lib

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!