Showing posts with label MSVC. Show all posts
Showing posts with label MSVC. Show all posts

2011-01-31

memory leak detection in MSVC

Keep losing that link - here it is.

2010-06-14

error LNK2005: strncmp already defined in LIBCMT.lib(strncmp.obj)

You're trying to mix "Multi-threaded (/MT)" with "Multi-threaded DLL (/MD)". Enough said.

2010-05-24

Compiling resource files with Visual Studio Express

If you pick a Visual Studio project with an MFC GUI app, and try to compile it with Visual Studio Express, you should run into the error:
fatal error RC1050: Cannot open include file 'afxres.h'.
The solution? Replace your:
#include "afxres.h"
from your .rc file with the following:
#include <windows.h>
#define IDC_STATIC -1

2010-03-18

Removing trailing whitespaces in Visual Studio

The following will remove trailing whitespaces whenever you save a file in Visual Studio 2008. Convenient!
  1. Go to Tools -> Macros -> Macro Explorer
  2. Double click "MyMacros -> Module1
  3. In the new Project Explorer Tree, double click on "EnvironmentEvents" above "Module1"
  4. After the #End Region for #Region "Automatically generated code, do not modify", add the following:
    Private saved As Boolean = False
        Private Sub DocumentEvents_DocumentSaved(ByVal document As EnvDTE.Document) _
                                                 Handles DocumentEvents.DocumentSaved
            If Not saved Then
                Try
                    ' Remove all the trailing whitespaces.
                    DTE.Find.FindReplace(vsFindAction.vsFindActionReplaceAll, _
                                         "{:Zs|\t}+$", _
                                         vsFindOptions.vsFindOptionsRegularExpression, _
                                         String.Empty, _
                                         vsFindTarget.vsFindTargetCurrentDocument, , , _
                                         vsFindResultsLocation.vsFindResultsNone)
    
                    saved = True
                    document.Save()
                Catch ex As Exception
                    MsgBox(ex.Message, MsgBoxStyle.OkOnly, "Trim White Space exception")
                End Try
            Else
                saved = False
            End If
        End Sub