C/C++ 接口

C/C++ 接口使您能够将 Antenna House Formatter V7.5 集成到 C/C++ 程序中。

头文件

[Install directory]/​include 中包含以下头文件。

头文件内容位置
xfoifc.hC++ 用头文件[Install directory]/​include
xfoifc_c.hC 用头文件

库文件

[Install directory]/​lib 或 [Install directory]/​lib 中包含以下库文件。

库文件内容位置
Windows 版 C/C++ 接口库[Install directory]
libXfoInterface.soLinux 版 C/C++ 接口库 [Install directory]/​lib
libXfoInterface.dylibMacintosh 版 C/C++ 接口库[Install directory]/​lib

在 Windows 版本中,[Install directory]/​lib 中包含以下用于链接的库文件。

库文件内容位置
XfoInterface.libDLL 链接用库[Install directory]/​lib

编译器相关问题

Windows

Antenna House Formatter V7.5 的 Windows 版本使用 Microsoft Visual C++ 2022 构建。在不使用 GUI 的情况下不使用 MFC。请为您的程序使用兼容的编译器。

Linux

Antenna House Formatter V7.5 的 Linux 版本(64 位版本)使用 GCC 13.3 构建。您的程序必须使用 GCC 13.3 或更高版本编译。Amazon Linux 2023 Graviton2 版本使用 GCC 14.2 构建,您的程序必须使用 GCC 14.2 或更高版本编译。有关 GCC 的详细信息,请参阅“GCC, the GNU Compiler Collection”。

Macintosh

Antenna House Formatter V7.5 的 Macintosh 版本(64 位版本)使用 Xcode10.1 Apple LLVM version 10.0.0(clang-1000.11.45.5) 构建。Macintosh M1 版本使用 Xcode12.4 LLVM 10.0.0 Apple clang version 12.0.0 (clang-1200.0.32.29) 构建。

构建示例程序

您可以从我们的网站下载简单的示例程序。

Windows

若要在 Windows 环境中使用 Visual C++ 的命令行构建示例,请按如下方式从控制台执行编译器:

以下各示例中的当前目录为包含示例解压所得 cpp 目录的那个目录。

> cd cpp
> cl -EHsc -I [Install directory]\include sample.cpp [Install directory]\lib\XfoInterface.lib /MT

若要构建 Windows 的可执行文件,请使用 [开始]-[Microsoft Visual Studio 2022]-[Visual Studio Tools] 中的命令提示符。

若要执行该程序,必须将 [Install directory]/​lib 追加到 PATH 环境变量中。示例的执行方式如下:

> sample sample.fo sample.pdf

Linux

以下命令行展示了如何在 Linux 环境中使用 GCC 构建该示例。

以下各示例中的当前目录为包含示例解压所得 cpp 目录的那个目录。

$ cd cpp
$ LD_LIBRARY_PATH=[Install directory]/lib:${LD_LIBRARY_PATH}
$ export LD_LIBRARY_PATH
$ g++ sample.cpp -I[Install directory]/include -L[Install directory]/lib -lXfoInterface -o Samplecppcmd -lstdc++ -lpthread

若要执行所构建的示例程序,还需要设置其他环境变量。有关详细信息,请参阅环境变量。

如前所述,GCC 的版本非常重要。请使用 --version 命令行选项检查您的 GCC 版本。

$ g++ --version
g++ (GCC) 13.3.1
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Macintosh

若要在 Macintosh 环境中构建示例,请按如下方式从终端执行编译器:

以下各示例中的当前目录为包含示例解压所得 cpp 目录的那个目录。

$ cd cpp
$ g++ sample.cpp -I[Install directory]/include -L[Install directory]lib -lXfoInterface -Wl,-rpath,@executable_path[Install directory]/lib -o Samplecppcmd

若要执行所构建的示例程序,同样需要设置其他环境变量。有关详细信息,请参阅环境变量。

API 规范