You are currently browsing the archives for the C++ category


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
	{
		...
	}
}

You might have an error like this.

The forward references (ref class) causes this. To fix this, separate them into another files.

In headerref.h (newly created)

#pragma once
namespace Ambiesoft {
	ref class EncComboItem;
	ref class CSearchURL;
}

In the original header,

#include "headerref.h"
 
namespace Ambiesoft {
	using namespace System;
 
	ref class AddHttpDicDialog : public System::Windows::Forms::Form
	{
		...
	}
}

CMake could not find boost

Create a new CMakeFiles.txt below in a new folder.

cmake_minimum_required(VERSION 3.7)

set(Boost_DEBUG 1)
set(Boost_DETAILED_FAILURE_MSG 1)

set(Boost_INCLUDE_DIR Y:/L/boost_1_53_0)
set(Boost_LIBRARY_DIR Y:/L/boost_1_53_0/lib)


set(Boost_USE_STATIC_LIBS        ON)
set(Boost_USE_MULTITHREADED      ON)

find_package(Boost 1.53 REQUIRED COMPONENTS
              date_time filesystem iostreams)

include_directories(${Boost_INCLUDE_DIR})
link_directories(${Boost_LIBRARY_DIR})

Adjust Boost_INCLUDE_DIR and Boost_LIBRARY_DIR to your environment and try to switch ON and OFF for Boost_USE_STATIC_LIBS and Boost_USE_MULTITHREADED.