jwf*_*arn 47 c++ visual-studio-2005 visual-studio-2008 visual-studio visual-c++
我知道我可以编译单个源文件,但有时 - 比如说,在编辑许多文件使用的头.cpp
文件时 - 需要重新编译多个源文件.这就是Build的用途.
VC9(Visual C++ 2008)中"Build"命令的默认行为是尝试编译需要它的所有文件.有时这只会导致许多失败的编译.我通常只是观察错误并点击ctrl-break来手动停止构建.
有没有办法配置它,以便构建在第一次编译错误(不是第一次失败的项目构建)自动停止?
Eri*_*ser 27
我想出了一个更好的宏观人物.它会在第一个错误/ s后立即停止(更新构建窗口时).
Visual Studio - >工具 - >宏 - >宏IDE ...(或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
Run Code Online (Sandbox Code Playgroud)
希望它适合你们.
jma*_*ias 17
这可以通过添加为响应事件OnBuildProjConfigDone而运行的宏来完成.
宏如下:
Private Sub BuildEvents_OnBuildProjConfigDone(ByVal Project As String, ByVal ProjectConfig As String, ByVal Platform As String, ByVal SolutionConfig As String, ByVal Success As Boolean) Handles BuildEvents.OnBuildProjConfigDone
If Success = False Then
DTE.ExecuteCommand("Build.Cancel")
End If
End Sub
Run Code Online (Sandbox Code Playgroud)
小智 8
是的,这在MSVC 2005-2010上运行良好:
Public Module EnvironmentEvents
Private Sub OutputWindowEvents_OnPaneUpdated(ByVal pPane As OutputWindowPane) Handles OutputWindowEvents.PaneUpdated
If Not (pPane.Name = "Build") Then Exit Sub
Dim foundError As Boolean = pPane.TextDocument.StartPoint.CreateEditPoint().FindPattern(": error")
Dim foundFatal As Boolean = pPane.TextDocument.StartPoint.CreateEditPoint().FindPattern(": fatal error")
If foundError Or foundFatal Then
DTE.ExecuteCommand("Build.Cancel")
End If
End Sub
End Module
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
19041 次 |
最近记录: |