有没有更好的方法来运行 c++来自 ac# 项目的 makefile?
我有一个 C# 项目,它使用绑定来使用一些 C++ 代码。 C++ 代码由多个使用 makefile 编译的 DLL 组成。目前我正在尝试使用调用 nmake 的预构建事件来运行 makefile。然而,为了让它找到 nmake,我需要在其中添加一行,如下所示:
"$(DevEnvDir)..\..\VC\vcvarsall.bat"
另外,即使存在该行,nmake 也不会在输出窗口中产生任何输出。它也不会抛出任何错误。我尝试将输出重定向到文件,但它没有写入任何内容。我已经在普通 shell 中重现了预构建事件中的所有步骤,并且工作正常。我想我一定是错过了什么。为什么 Visual Studio 不为我的预生成事件提供 Visual Studio shell?有没有更好的方法来运行这个 makefile?如果没有,有没有人知道为什么 nmake 不产生任何输出?
编辑:天啊! nmake 没有运行,因为我忘记将“call”添加到行的开头,即:
call "$(DevEnvDir)..\..\VC\vcvarsall.bat"
I have a project in c# which uses bindings to use some c++ code. The c++ code consists of multiple DLL's which are compiled using a makefile. Currently I'm trying to run the makefile using a pre build event which calls nmake. However to get it to find nmake I need to have a line in it like the following:
"$(DevEnvDir)..\..\VC\vcvarsall.bat"
Also, even with that line present, nmake doesn't produce any output at all in the output window. Neither does it throw any errors. I tried redirecting the output to a file and it doesn't write anything. I have reproduced all steps in my pre build event in a normal shell and it works fine. I figure I must be missing something. Why doesn't Visual Studio give me a Visual Studio shell for my pre build event? Is there a better way to run this makefile? If not, has anyone got any ideas as to why nmake isn't producing any output?
EDIT: D'oh! nmake wasn't running as I forgot to add 'call' to the start of the line, i.e:
call "$(DevEnvDir)..\..\VC\vcvarsall.bat"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我经常构建非 VS 项目(有时使用 nmake,有时使用其他构建工具)作为更大解决方案构建的一部分。
我倾向于制作一个简单的批处理文件,它设置环境然后运行 make。
我从构建事件中调用批处理文件(通常是在我的东西上构建后) - 通常前面有一张 CD:
从来没有(无论如何我记得)控制台窗口中出现的输出有任何问题。
I often build non VS-project (sometimes with nmake, sometimes with other build tools) as a part of a larger solution build.
I tend to make a simple batch file, which sets up the environment and then runs the make.
I call the batch file from a build event (often post-build on my stuff) - usually with a CD on the front:
Never (that I can remember, anyway) had any problem with the output appearing in the console window.