安装

安装 Aspose.Email FOSS for C++

Aspose.Email FOSS for C++ 没有外部依赖。它需要 C++17 编译器
和 CMake 3.14 或更高版本。

步骤 1:克隆仓库

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

步骤 2:添加为 CMake 子目录

在您的项目 CMakeLists.txt

cmake_minimum_required(VERSION 3.14)
project(my_project)

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

add_executable(my_app main.cpp)
target_link_libraries(my_app PRIVATE aspose_email_foss)

步骤 3:包含标头

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

所有公共头文件位于 include/aspose/email/foss/ 下。两个主要子系统是:

子系统头文件目录关键类
CFBcfb/cfb_reader, cfb_writer, cfb_document, cfb_node
MSGmsg/mapi_message, msg_reader, msg_writer, msg_document

步骤 4:构建并验证

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

使用最小程序进行验证:

#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
}

受支持的平台

平台编译器最低版本
LinuxGCC9+
LinuxClang10+
macOSApple Clang12+
WindowsMSVC2019 (16.0+)

该库在所有平台上构建完全相同,且没有平台特定的代码或本机依赖。

 中文