What are the implications of using /Zi vs /Z7 for Visual Studio C++ projects?

Codeview is a much older debugging format that was introduced with Microsoft’s old standalone debugger back in the “Microsoft C Compiler” days of the mid-1980s. It takes up more space on disk and it takes longer for the debugger to parse, and it’s a major pain to process during linking. We generated it from our … Read more

Compilation fails randomly: “cannot open program database”

It is possible that an antivirus or a similar program is touching the pdb file on write – an antivirus is the most likely suspect in this scenario. I’m afraid that I can only give you some general pointers, based on my past experience in setting nightly builds in our shop. Some of these may … Read more

Elegant way to go from list of objects to dictionary with two of the properties

With LINQ: var fooDict = foos.ToDictionary(x=>x.Name,x=>x.StreetAddress); (and yes, fooDict is Dictionary<string, string>) edit to show the pain in VS2005: Dictionary<string, string> fooDict = Program.ToDictionary<Foo, string, string>(foos, delegate(Foo foo) { return foo.Name; }, delegate(Foo foo) { return foo.StreetAddress; }); where you have (in Program): public static Dictionary<TKey, TValue> ToDictionary<TSource, TKey, TValue>( IEnumerable<TSource> items, Converter<TSource, TKey> keySelector, … Read more

Runtime error R6034 in embedded Python application

The problem was caused by third-party software that had added itself to the path and installed msvcr90.dll in its program folder. In this case, the problem was caused by Intel’s iCLS Client. Here’s how to find the problem in similar situations: Download Process Explorer here. Start your application and reproduce runtime error R6034. Start Process … Read more

error LNK2005: new and delete already defined in LIBCMTD.lib(new.obj)

The CRT libraries use weak external linkage for the new, delete, and DllMain functions. The MFC libraries also contain new, delete, and DllMain functions. These functions require the MFC libraries to be linked before the CRT library is linked. http://support.microsoft.com/kb/148652 Solution based on VS2005 (Replace Nafxcwd.lib with Uafxcwd.lib for ~VS2013) go to project>properties>configuration properties>linker>input add … Read more

Automatically stop Visual C++ 2008 build at first compile error?

I came up with a better macro guys. It stops immediately after the first error/s (soon as build window is updated). 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 … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)