0

试图分解 DDS 消息的大型 IDL 定义文件,并将一些常见类型移动到另一个 idl 定义中以使事情更易于管理。

错误 1>FooTypesTypeSupportImpl.obj:错误 LNK2005:Java_foo_FooTypeTypeSupportImpl__1jni_1init 已在 BarTypeTypeSupportImpl.obj 中定义

FooType.idl

 module foo {
  #pragma DCPS_DATA_TYPE "foo::FooType"  
  struct FooType {
    string publisherID;
    double timestampMs;
  };

};

BarTypes.idl

module bar {
  #pragma DCPS_DATA_TYPE "bar::TestMsg"  
  struct TestMsg {
    foo::FooType fooInfo;
    string key;
  };

};

构建FooBar.mpc

project (FooBar): dcps_java {
  idlflags      += -Wb,stub_export_include=BarType_Export.h \
                   -Wb,stub_export_macro=BarType_Export
  dcps_ts_flags += -Wb,export_macro=BarType_Export
  idl2jniflags  += -Wb,stub_export_include=BarType_Export.h \
                   -Wb,stub_export_macro=BarType_Export
  dynamicflags  += BARTYPE_BUILD_DLL

  specific {
    jarname      = DDS_Test_Msg
  }

  TypeSupport_Files {
    BarType.idl
    FooTypes.idl
  }
}

BuildFooBar.bat

REM Changing Directory to Development FooBar
cd D:\dds\FooBar

REM Generating BarType_Export.h
"%ACE_ROOT%"\bin\generate_export_file.pl BarType > BarType_Export.h

REM Generating FooTypes_Export.h
"%ACE_ROOT%"\bin\generate_export_file.pl FooTypes > FooTypes_Export.h

REM Generating new VS Code Project
"%ACE_ROOT%"\bin\mwc.pl -type vs2019

REM Starting VS Code
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\devenv.exe" FooBar.sln
4

1 回答 1

0

在OpenDDS 邮件列表中进一步讨论

于 2021-02-12T12:18:42.070 回答