Installation

Install Aspose.Email FOSS for C++

This guide shows how to install Aspose.Email FOSS for C++ by cloning the repository, adding it as a CMake subdirectory, and linking it to your application. The library has no external dependencies and requires a C++17 compiler and CMake 3.26 or later.

Step 1: Clone the Repository

Clone the repository from GitHub into your project directory before adding it to your CMake build:

git clone https://github.com/aspose-email-foss/Aspose.Email-FOSS-for-Cpp.git

Step 2: Add as CMake Subdirectory

In your project’s CMakeLists.txt, call add_subdirectory with the cloned folder and then link the AsposeEmailFoss::AsposeEmailFoss target to your executable:

cmake_minimum_required(VERSION 3.26)
project(my_project)

add_subdirectory(Aspose.Email-FOSS-for-Cpp)

add_executable(my_app main.cpp)
target_link_libraries(my_app PRIVATE AsposeEmailFoss::AsposeEmailFoss)

Step 3: Include Headers

Include the relevant subsystem headers at the top of your source files to access mapi_message for MSG processing and cfb_reader for raw CFB container access:

#include "aspose/email/foss/msg/mapi_message.hpp"
#include "aspose/email/foss/cfb/cfb_reader.hpp"

All public headers live under include/aspose/email/foss/. The two main subsystems are:

SubsystemHeader directoryKey classes
CFBcfb/cfb_reader, cfb_writer, cfb_document, cfb_node
MSGmsg/mapi_message, msg_reader, msg_writer, msg_document

Step 4: Build and Verify

Run CMake to configure and build your project, then compile and run the verification program below to confirm the library links correctly:

cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build

Verify with a minimal program that creates a mapi_message object and prints its subject to stdout:

#include <iostream>
#include "aspose/email/foss/msg/mapi_message.hpp"

int main()
{
    auto message = aspose::email::foss::msg::mapi_message::create("Test", "Hello");
    std::cout << message.subject() << '\n';
    // Output: Test
}

Supported Platforms

PlatformCompilerMinimum version
LinuxGCC9+
LinuxClang10+
macOSApple Clang12+
WindowsMSVC2019 (16.0+)

The library builds identically on all supported platforms using standard C++17 with no platform-specific code or native dependencies.

See Also

 English