自动停止Visual C ++ 2008 build首次编译错误? [英] Automatically stop Visual C++ 2008 build at first compile error?

查看:118
本文介绍了自动停止Visual C ++ 2008 build首次编译错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我可以编译单个源文件,但有时 - 例如,当编辑许多 .cpp 文件使用的头文件时 - 多个源文件需要重新编译。这是Build是为了。

I know I can compile individual source files, but sometimes -- say, when editing a header file used by many .cpp files -- multiple source files need to be recompiled. That's what Build is for.

VC9(Visual C ++ 2008)中Build命令的默认行为是试图编译所有需要它的文件。有时这只会导致许多失败的编译。我通常只是看错误,并按下ctrl-break手动停止构建。

Default behavior of the "Build" command in VC9 (Visual C++ 2008) is to attempt to compile all files that need it. Sometimes this just results in many failed compiles. I usually just watch for errors and hit ctrl-break to stop the build manually.

有一种方法来配置它,这样的构建停止在非常第一

Is there a way to configure it such the build stops at the very first compile error (not the first failed project build) automatically?

推荐答案

我想出了一个更好的宏的家伙。

I came up with a better macro guys. It stops immediately after the first error/s (soon as build window is updated).

Visual Studio - >工具 - >宏 - >宏IDE ...(或更新版本) ALT + F11)

Visual Studio -> Tools -> Macros -> Macro IDE... (or ALT+F11)

Private Sub OutputWindowEvents_OnPaneUpdated(ByVal pPane As OutputWindowPane) Handles OutputWindowEvents.PaneUpdated
    If Not (pPane.Name = "Build") Then Exit Sub

    pPane.TextDocument.Selection.SelectAll()
    Dim Context As String = pPane.TextDocument.Selection.Text
    pPane.TextDocument.Selection.EndOfDocument()

    Dim found As Integer = Context.IndexOf(": error ")

    If found > 0 Then
        DTE.ExecuteCommand("Build.Cancel")
    End If

End Sub

希望它适合你们。

这篇关于自动停止Visual C ++ 2008 build首次编译错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆