简体   繁体   English

如何为这个C ++ Windows项目制作一个“ make.bat”?

[英]How to make a “make.bat” for this C++ Windows project?

I am highly allergic to using the Visual Studio / C++ IDE. 我对使用Visual Studio / C ++ IDE过敏。

Instead, I would like to be able to code with my usual text editor ( Sublime Text for instance), and to build the project with a make.bat file. 相反,我希望能够使用常用的文本编辑器(例如Sublime Text )进行编码,并使用make.bat文件构建项目。

Here is an example package (mdaDX10 is an audio VSTi, available open-source) and here is the make.bat file I made: 这是一个示例包 (mdaDX10是音频VSTi,可用开源),这是我制作的make.bat文件:

call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86
cl mdaDX10.cpp

Unfortunately, this doesn't work: it tries to build a .exe whereas the output should be a .dll (VST audio plugins are DLLs). 不幸的是,这是行不通的:它试图构建.exe而输出应该是.dll (VST音频插件是DLL)。

How to make a clean IDE-independant make.bat for such a project? 如何为这样的项目制作干净的,独立于IDE的make.bat


Here is a part of the error: 这是错误的一部分:

[...]
/out:mdaDX10.exe
mdaDX10.obj
mdaDX10.obj : error LNK2019: unresolved external symbol "public: virtual void __
thiscall AudioEffectX::isSynth(bool)" (?isSynth@AudioEffectX@@UAEX_N@Z) referenc
ed in function "public: __thiscall mdaDX10::mdaDX10(int (__cdecl*)(struct AEffec
t *,int,int,int,void *,float))" (??0mdaDX10@@QAE@P6AHPAUAEffect@@HHHPAXM@Z@Z)
mdaDX10.obj : error LNK2019: unresolved external symbol "public: virtual void __
thiscall AudioEffect::canProcessReplacing(bool)" (?canProcessReplacing@AudioEffe
ct@@UAEX_N@Z) referenced in function "public: __thiscall mdaDX10::mdaDX10(int (_
_cdecl*)(struct AEffect *,int,int,int,void *,float))" (??0mdaDX10@@QAE@P6AHPAUAE
ffect@@HHHPAXM@Z@Z)
[...]

Calling 调用

cl /? 

will give you a list of options. 将为您提供选项列表。 /LD is the flag to create a dll / LD是创建dll的标志

cl's options are also documented online https://msdn.microsoft.com/en-us/library/fwkeyyhe.aspx cl的选项也在线记录在文档中https://msdn.microsoft.com/zh-cn/library/fwkeyyhe.aspx

However, I'd recommend moving away from creating these files yourself, and towards a more general, more powerful solution, like cmake or you might find your scripts become quickly less clean and harder to maintain to meet your needs. 但是,我建议您不要自己创建这些文件,而转向像cmake这样的更通用,更强大的解决方案,否则您可能会发现脚本变得不那么干净,难以维护以满足您的需求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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