Basic usage of unique_ptr and custom free of it

#include <Windows.h>   #include <iostream> #include <memory>   #pragma comment(lib, "Shell32.lib") using namespace std;   class MyClass { public: MyClass() { cout << "ctor" << endl; } ~MyClass() { cout << "dtor" << endl; } };   int main() { { // basic unique_ptr<MyClass> p1(new MyClass); unique_ptr<MyClass> p2 = make_unique<MyClass>(); }   { int* pI […]

“new.h” or “ctype.h” is missing in Visual Studio 2017

Visual Studio has some bugs to not find install component properly. If you encounter this error, take a following step. 1, Launch Visual Studio Installer. If it starts to update itself. The problem may be fixed. Just update it (not install any components). 2, Launch your Solution. If Visual Studio failed to load projects properly, […]

Visual Studio’s resource editor fails to open a Form because the class is not the first class in the header file (C++/CLI)

Suppose you have a following header file and tries to open it in the resource editor of Visual Studio. namespace Ambiesoft { using namespace System;   ref class EncComboItem; ref class CSearchURL;   ref class AddHttpDicDialog : public System::Windows::Forms::Form { … } }namespace Ambiesoft { using namespace System; ref class EncComboItem; ref class CSearchURL; ref […]

warning LNK4075: ignoring ‘/EDITANDCONTINUE’ due to ‘/SAFESEH’ specification

When you upgraded your VC++ project to Visual Studio 2013 or later(?), this warning appears. It looks like VS failed to upgrade projects properly. <PropertyGroup Condition=”‘$(Configuration)|$(Platform)’==’UnicodeDebug|Win32′” Label=”Configuration”> <ConfigurationType>Application</ConfigurationType> <PlatformToolset>v120</PlatformToolset> <UseOfMfc>Dynamic</UseOfMfc> <CharacterSet>Unicode</CharacterSet> </PropertyGroup> It needs to add “<UseDebugLibraries>true</UseDebugLibraries>” to your *.vcxproj file. See the following fixed file. In a Release configuration, it needs to set false […]