我使用 Aspose for Email 构建了一个程序。这是使用 MSVC 2019 使用 Visual Studio 2022 开发的。为此,我按照 https://docs.aspose.com/email/cpp/installation/
使用 Nuget 包管理器安装了 Aspose 库现在我想以可以使用 CMake 构建它的方式配置我的项目。但是,通过 .zip 的安装步骤是不存在的。
我写了一个基本的 CMakeLists.txt,它允许我使用 zip 存档中的标题:
cmake_minimum_required(VERSION 3.5)
project(test VERSION 0.1 LANGUAGES CXX)
include_directories("./include/Aspose.Email.Cpp/")
include_directories("./include/asposecpplib/")
set(PROJECT_SOURCES main.cpp)
add_executable(prog ${PROJECT_SOURCES} )
具有以下 main.cpp:
#include <iostream>
#include <Mapi/MapiMessage.h>
int main()
{
std::cout << "ok" << std::endl;
}
工作正常,找到了库。一旦我需要使用
System
命名空间中的类,事情就会变得复杂起来。例如,下面的新代码:
#include <iostream>
#include <system/string.h>
#include <Mapi/MapiMessage.h>
int main()
{
System::String myString;
std::cout << "ok" << std::endl;
}
会在
make
步骤中给出以下错误:
main.cpp:(.text+0x10): undefined reference to `System::String::String()'
According to the documentation, String class is defined in the
string.h
header, that I included so I don't understand the undefined reference.
此构建过程中缺少什么才能使其正常工作?
我在 Docker 容器中工作:Ubuntu 16.04 与 GCC 6.2、CMake 3.5.1 和 Aspose.Email C++ 23.1