将idl文件编译为rdb文件时出现错误

问题描述 投票:0回答:1

下午好。 我有一个 idl 文件,这是其内容:

#include <com/sun/star/uno/XInterface.idl>

module org { module libreoffice { module sheet { module formulas {

interface XDataLinkFormulas : com::sun::star::uno::XInterface {
    long Vol(
        [in] long a,
        [in] long b,
        [in] long c
    );
};

}; }; }; };

在Linux上,我使用以下命令将这些文件编译成rdb文件:

sudo ./unoidl-write formulas.idl formulas.rdb

但是,此命令失败并出现以下错误:

错误的输入文件:///opt/libreoffice7.5/sdk/bin/formulas.idl:无法解析第4行:“接口类型org.libreoffice.sheet.formulas.XDataLinkFormulas直接基com.sun.star.uno.XInterface无法解析为现有的接口类型”

问题:如何修复这个错误,因为我是通过类比现有示例来修改idl文件的内容的。

附注我将我的idl(formulas.idl)文件放在以下目录中(/opt/libreoffice7.5/sdk/bin)

sdk libreoffice-calc uno
1个回答
0
投票

网上给出的例子是:

unoidl-write $unoTypes $offTypes com/sun/star/test/XSomethingA.idl XSomething.rdb

但是,我在 7.5 中尝试过此操作,但无法使其正常工作,因此现在,我回到了

LibreOffice 7.4 及更早版本
中的
idlc
regmerge。旧类型注册表格式仍然与 7.5 以及所有以前的版本兼容,不像
unoidl
需要 4.1 或更高版本(诚然,可能没有人再使用旧版本了)。

这是来自开发人员指南的 Linux 示例:

# make project folder the current directory
cd /home/sdk/Thumbs

# compile XImageShrink.idl using idlc 
# usage: idlc [-options] file_1.idl ... file_n.idl
# -C adds complete type information including services
# -I includepath tells idlc where to look for include files
#
# idlc writes the resulting urds to the current folder by default
idlc -C -I../idl XImageShrink.idl

# create registry database (.rdb) file from UNO registry data (.urd) using regmerge
# usage: regmerge mergefile.rdb mergeKey regfile_1.urd ... regfile_n.urd
# mergeKey entry in the tree-like rdb structure where types from .urd should be recorded, the tree 
# starts with the root / and UCR is the default key for type descriptions
#
# regmerge writes the rdb to the current folder by default
regmerge thumbs.rdb /UCR XImageShrink.urd

# generate Java class files for new types from rdb
# -B base node to look for types, in this case UCR
# -T type to generate Java files for
# -nD do not generate sources for dependent types, they are available in the Java UNO jar files
#
# javamaker creates a directory tree for the output files according to 
# the modules the given types were placed in. The tree is created in the current folder by default
javamaker -BUCR -Torg.openoffice.test.XImageShrink -nD <OFFICE_PROGRAM_PATH>/types.rdb thumbs.rdb

# generate C++ header files (hpp and hdl) for new types and their dependencies from rdb
# -B base node to look for types, in this case UCR
# -T type to generate C++ header files for
#
# cppumaker creates a directory tree for the output files according to
# the modules the given types were placed in. The tree is created in the current folder by default
cppumaker -BUCR -Torg.openoffice.test.XImageShrink <OFFICE_PROGRAM_PATH>/types.rdb thumbs.rdb

这是我在 Windows 上使用的批处理脚本。

rem @echo off
:: Adapted by Jim K 5-Dec-2012.
:: Based on [email protected] 2009.

SET IDL_FILE=..\idl\XCalcFunctions
SET OOO_HOME=C:\Program Files\LibreOffice 3.6
set SDK_HOME=C:\Program Files\OpenOffice.org 3 SDK\sdk

SET OOO_BIN_DIR=%OOO_HOME%\program
SET TOOLS_BIN_DIR=%SDK_HOME%\bin

:: The IDL tools rely on supporting files in the main OOo installation.
PATH=%PATH%;%OOO_HOME%\URE\bin

SET IDL_INCLUDE_DIR=%SDK_HOME%\idl

"%TOOLS_BIN_DIR%\idlc.exe" -w -I "%IDL_INCLUDE_DIR%" %IDL_FILE%.idl

:: Convert compiled IDL to loadable type library file.
:: First remove existing .rdb file, otherwise regmerge will just
:: append the compiled IDL to the resulting .rdb file. The joy of
:: having an .rdb file with several conflicting versions of compiled
:: IDL is very very limited - don't go there.
if exist %IDL_FILE%.rdb. (
del %IDL_FILE%.rdb
)
"%OOO_HOME%\URE\bin\regmerge.exe" %IDL_FILE%.rdb /UCR %IDL_FILE%.urd

del %IDL_FILE%.urd

我使用的 IDL 和 XCU 文件完整列出于 https://ask.libreoffice.org/t/how-to-use-develop-addins-in-calc/28138/

© www.soinside.com 2019 - 2024. All rights reserved.