Tag Archives: visual-studio

Building BOOST with MSVC2022

I built BOOST with MSVC2022 in a similar way I built it with MSVC2017 except that I did install, but not stage:

cd C:\dev\repos\boost_1_80_0

set OPENSSL_ROOT_DIR=C:/dev/libs/OpenSSL
set OPENSSL_USE_STATIC_LIBS=ON

bootstrap.bat

b2 install --prefix=C:/dev/libs/boost_1_80_0 --toolset=msvc-14.3 link=static runtime-link=static variant=release address-model=64
b2 install --prefix=C:/dev/libs/boost_1_80_0 --toolset=msvc-14.3 link=static runtime-link=static variant=debug address-model=64

I am not sure if OPENSSL_ROOT_DIR takse an effect because boost::asio is header-only (but it depends on system and thread modules).

(more…)

Generating .NET wrappers for COM during build in MS Visual Studio

If in some Visual Studio solution a .NET project references a C++ project that implements a COM server then the following command can be used in Post-Build Event of the C++ project to generate .NET wrapper for COM:

"$(TargetFrameworkSDKToolsDirectory)tlbimp.exe" "$(TargetPath)" /verbose /strictref /asmversion=$(Version) /out:"$(TargetDir)$(TargetName)Lib.dll"

In VS2015 by default this command will generate .NET 4.0 assembly. To generate .NET 2.0 assembly, the following command can be used:

"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\TlbImp.exe" "$(TargetPath)" /verbose /strictref /asmversion=$(Version) /out:"$(TargetDir)$(TargetName)Lib.dll"

I am not sure that changing TargetFrameworkVersion attribute in PropertyGroup Label=”Globals” element of the project file can help here, so it is not clear how to get rid of absolute path.

Also it is impossible to add a reference to a TLB or EXE file to .NET assembly, so using TLB generated by MIDL directly is not an option (MIDL->Output page of C++ project using $(OutDir)$(TargetName).tlb as Type Library name).

How to debug classic ASP with VS2015 and IIS Express

Change configuration/system.webServer/serverRuntime/asp section of $(SolutionDir).vs\config\applicationhost.config file to:

<asp scriptErrorSentToBrowser="true" enableParentPaths="true" bufferingOn="true" errorsToNTLog="true" appAllowClientDebug="true" appAllowDebugging="true">
    <cache diskTemplateCacheDirectory="%TEMP%\iisexpress\ASP Compiled Templates" />
    <session allowSessionState="true" />
    <limits />
</asp>

Open the website in a browser and then in VS2015 go to Debug->Attach To Process, change code type to Script and select iisexpress.exe. After that in browser navigate to a page you want to debug and Script Documents section will appear in Solution Explorer allowing you to set breakpoints on listed pages. Actually you do all the steps described in this post, except that you edit not the global IIS Express configuration, but local configuration located in VS2015 solution subdirectory .vs\config.

Links:

How to compile QT with VS2015 and GCC

Below I provided a simple step by step instruction on how to compile QT 5.7 with VS2015 assuming you already have VS2015 and Git client installed on your Windows machine.

Install Perl, Python and Ruby.

To get QT 5.7 sources open Git Bash and run the following command (the repository has some submodules, so “recursive” option is required), see the list of possible clone here at the bottom of the page:

git clone --recursive https://github.com/qtproject/qt5.git --branch 5.7

Create a bat file called configureqt.bat with the following content:

set PATH=%PATH%;"C:\Program Files (x86)\Portable\ruby-2.3.0-i386-mingw32\bin";C:\Perl\bin;C:\Python27
D:
cd D:\Repos\qt5\
set _ROOT=D:\Repos\qt5
set PATH=%_ROOT%\qtbase\bin;%_ROOT%\gnuwin32\bin;%PATH%
set QMAKESPEC=win32-msvc2015
set _ROOT=
configure -debug -nomake examples -opensource

(more…)

Debugging a C++ application on an Android device with VS2015 on Windows 10

VS2015 has an exciting ability to debug a C++ application on Android Emulator, but in this article I will talk about no less exciting and more time expensive ability to debug a C++ application on a real Android device. The first thing we need to spend the time with is figuring out how to enable USB debugging mode on our Android device. On my ASUS Zenfone I need to go to Settings->About->Software Information and tap on Build Number 7 times, after that I have USB debugging check box in Settings->Developer Options that I should tap as well:

enabling USB debugging mode on Android device USB debugging mode on Android device

(more…)

How to uninstall Microsoft Advertising SDK for Windows 8.1

Windows 10 Advertising SDK Walkthrough article states that “it is highly recommended that you uninstall all prior instances of the Advertising SDK”. I am not sure that the article is relevant, because it mentions some preview version of SDK, but never too much of a good thing, so I decided to get rid of Advertising SDK for Windows 8.1 that is listed in VS2015 extensions along with the new SDK:

Microsoft Advertising SDK for Windows 8.1

(more…)

Building GDAL with Visual Studio 2013 and 2015

Unfortunately, GDAL 2.0.1 does not build with VS2015. I tried to build it with the following command from Command Prompt:

nmake /f makefile.vc

having gdal-2.0.1 as the current directory. Build has taken some significant time, but finally got some liker error “odbccp32.lib(dllload.obj) : error LNK2019: unresolved external symbol __vsnwprintf_s referenced in function”:

building GDAL with VS2015

(more…)

How to open a project from Git repository in MS Visual Studio 2013

Below I provided the key steps for opening a project in MS Visual Studio 2013 from a Git repository.

First, go to TOOLS->Options->Source Control and select Microsoft Git Provider:

Microsoft Git Provider

(more…)

Debugging .NET Framework with Visual Studio 2013

Visual Studio 2013 allows easily to debug .NET 4.5.1 Framework source code. If you use a previous version of .NET (4.5 or earlier) change the target .NET version of the your projects to 4.5.1 or higher. If you have some C++ CLI projects modify TargetFrameworkVersion attribute manually in all *.vcxproj files:

<PropertyGroup Label="Globals">
  ...
  <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
  ...
</PropertyGroup>

then go to Tools->Options->Debugging->General and check/uncheck the following options:

Debugging .NET Framework with Visual Studio 2013

(more…)

Using Visual Leak Detector with MS Visual Studio 2013

Go to Tools->Extensions and Updates, download and install Using Visual Leak Detector:

Using Visual Leak Detector

Create a header file, named, for example, CommonTools.h containing the following:

#pragma once

#include "C:\Program Files (x86)\Visual Leak Detector\include\vld.h" 

#pragma comment(lib, "C:\\Program Files (x86)\\Visual Leak Detector\\lib\\Win32\\vld.lib")

Include CommonTools.h in at least one file in all the C++ projects in your solution. Build debug version of the program. Visual Leak Detector will write the information on memory leaks to Output window when the program exits.