How do I create both a .lib file and an .exe file in Visual C++?

前端 未结 5 1863
后悔当初
后悔当初 2021-02-07 10:51

I currently have a console project which creates an .exe file; I want it to also create a .lib file so other projects, compiled as DLLs, would be able to call functions from the

5条回答
  •  北海茫月
    2021-02-07 11:19

    It is amazing how many contributors arrogantly insists on an answer that is wrong, when they simply don't know the answer.

    To generate a .lib associated with your .exe place the following line in Pre-Link Event:

    "$(VC_ExecutablePath_x86)\lib.exe" /out:"$(OutDir)$(ProjectName).lib" "$(IntermediateOutputPath)*.obj"
    

提交回复
热议问题