使用 MPC

问题描述

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

ERROR 1>FooTypestypeSupportImpl.obj : error LNK2005: Java_foo_FooTypeTypeSupportImpl__1jni_1init already 在 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;
  };

};

BuildFooBar.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_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

解决方法

进一步讨论 OpenDDS mailing list