Multiple definition of type when linking



Hi all,

I'm having problems linking *-common.o files generated with orbit-idl-2
(Orbit2 2.4.1 on Red Hat 8) and I can't understand why. I'm getting the
following output from the compiler:

gcc -o libflex.so -shared flexadapter.o referenceutil.o
AdapterServer-stubs.o AdapterServer-common.o C_VectorData-stubs.o
C_VectorData-common.o vectordata.o C_KeyValuePair-stubs.o
C_KeyValuePair-common.o flexkeyvaluepair.o C_DynamicAttribute-stubs.o
C_DynamicAttribute-common.o flexdynamicattribute.o C_Attributes-stubs.o
C_Attributes-common.o flexattributes.o translator.o -Wl,--export-dynamic
-L/usr/lib -lORBit-2 -llinc -lgmodule-2.0 -ldl -lgobject-2.0
-lgthread-2.0 -lpthread -lglib-2.0 -lm -lORBitCosNaming-2 -lcurl -lssl
-lcrypto
C_DynamicAttribute-common.o(.data.rel.ro+0x20): multiple definition of
`TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_struct'
C_KeyValuePair-common.o(.data.rel.ro+0x20): first defined here
C_Attributes-common.o(.data.rel.ro+0x40): multiple definition of
`TC_se_foo_flex_appl_adapterinterface_dc_C_Attributes_struct'
AdapterServer-common.o(.data.rel.ro+0x40): first defined here
collect2: ld returned 1 exit status
make: *** [lib] Error 1

It seem, by e.g. looking at the files C_DynamicAttribute-common.c and
C_KeyValuePair-common.c that the struct
TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_struct has been
defined in both of them. The idl files that I used to generate these
files from are:

C_KeyValuePair.idl
==================
#ifndef C_KeyValuePair_idl
#define C_KeyValuePair_idl

module se {
    module foo {
        module flex {
            module appl {
                module adapterinterface {
                    module dc {
                        struct C_KeyValuePair {
                            long key;
                            string value;
                        };
                    };
                };
            };
        };
    };
};

#endif

C_DynamicAttribute.idl
======================
#ifndef C_DynamicAttribute_idl
#define C_DynamicAttribute_idl

#include "C_KeyValuePair.idl"

module se {
    module foo {
        module flex {
            module appl {
                module adapterinterface {
                    module dc {
                        struct C_DynamicAttribute {
                            long            id;
                            string          name;
                            C_KeyValuePair  dataType;
                            C_KeyValuePair  format;
                            string          value;
                            long            comparisonOperator;
                        };
                    };
                };
            };
        };
    };
};

#endif


And the generated *-common.c files are:

C_KeyValuePair-common.c
=======================
/*
 * This file was generated by orbit-idl-2 - DO NOT EDIT!
 */

#include <string.h>
#define ORBIT2_STUBS_API
#define ORBIT_IDL_C_COMMON
#define C_KeyValuePair_COMMON
#include "C_KeyValuePair.h"

static const CORBA_unsigned_long ORBit_zero_int = 0;

#if ( (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_0
== 'C') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_1 ==
'_') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_2 ==
'K') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_3 ==
'e') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_4 ==
'y') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_5 ==
'V') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_6 ==
'a') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_7 ==
'l') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_8 ==
'u') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_9 ==
'e') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_10 ==
'P') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_11 ==
'a') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_12 ==
'i') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_13 ==
'r') \
) &&
!defined(TC_DEF_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair)
#define TC_DEF_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair 1
static const char *anon_subnames_array40[] = { "key", "value" };
static const CORBA_TypeCode anon_subtypes_array41[] =
   { (CORBA_TypeCode) & TC_CORBA_long_struct,
(CORBA_TypeCode) & TC_CORBA_string_struct };
#ifdef ORBIT_IDL_C_IMODULE
static
#endif
const struct CORBA_TypeCode_struct
   TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_struct = {
   {&ORBit_TypeCode_epv, ORBIT_REFCOUNT_STATIC},
   CORBA_tk_struct,
   0,
   0,
   4,
   0,
   2,
   (CORBA_TypeCode *) anon_subtypes_array41,
   CORBA_OBJECT_NIL,
   "C_KeyValuePair",
   "IDL:se/foo/flex/appl/adapterinterface/dc/C_KeyValuePair:1.0",
   (char **) anon_subnames_array40,
   NULL,
   -1,
   0,
   0, 0
};
#endif

/* Interface type data */

C_DynamicAttribute-common.c
===========================
/*
 * This file was generated by orbit-idl-2 - DO NOT EDIT!
 */

#include <string.h>
#define ORBIT2_STUBS_API
#define ORBIT_IDL_C_COMMON
#define C_DynamicAttribute_COMMON
#include "C_DynamicAttribute.h"

static const CORBA_unsigned_long ORBit_zero_int = 0;

#if ( (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_0
== 'C') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_1 ==
'_') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_2 ==
'D') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_3 ==
'y') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_4 ==
'n') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_5 ==
'a') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_6 ==
'm') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_7 ==
'i') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_8 ==
'c') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_9 ==
'A') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_10 ==
't') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_11 ==
't') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_12 ==
'r') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_13 ==
'i') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_14 ==
'b') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_15 ==
'u') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_16 ==
't') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_17 ==
'e') \
) &&
!defined(TC_DEF_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair)
#define TC_DEF_TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair 1
static const char *anon_subnames_array43[] = { "key", "value" };
static const CORBA_TypeCode anon_subtypes_array44[] =
   { (CORBA_TypeCode) & TC_CORBA_long_struct,
(CORBA_TypeCode) & TC_CORBA_string_struct };
#ifdef ORBIT_IDL_C_IMODULE
static
#endif
const struct CORBA_TypeCode_struct
   TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_struct = {
   {&ORBit_TypeCode_epv, ORBIT_REFCOUNT_STATIC},
   CORBA_tk_struct,
   0,
   0,
   4,
   0,
   2,
   (CORBA_TypeCode *) anon_subtypes_array44,
   CORBA_OBJECT_NIL,
   "C_KeyValuePair",
   "IDL:se/foo/flex/appl/adapterinterface/dc/C_KeyValuePair:1.0",
   (char **) anon_subnames_array43,
   NULL,
   -1,
   0,
   0, 0
};
#endif
#if (
(TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_DynamicAttribute_0 ==
'C') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_DynamicAttribute_1
== '_') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_DynamicAttribute_2
== 'D') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_DynamicAttribute_3
== 'y') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_DynamicAttribute_4
== 'n') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_DynamicAttribute_5
== 'a') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_DynamicAttribute_6
== 'm') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_DynamicAttribute_7
== 'i') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_DynamicAttribute_8
== 'c') \
&& (TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_DynamicAttribute_9
== 'A') \
&&
(TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_DynamicAttribute_10
== 't') \
&&
(TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_DynamicAttribute_11
== 't') \
&&
(TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_DynamicAttribute_12
== 'r') \
&&
(TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_DynamicAttribute_13
== 'i') \
&&
(TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_DynamicAttribute_14
== 'b') \
&&
(TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_DynamicAttribute_15
== 'u') \
&&
(TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_DynamicAttribute_16
== 't') \
&&
(TC_IMPL_TC_se_foo_flex_appl_adapterinterface_dc_C_DynamicAttribute_17
== 'e') \
) &&
!defined(TC_DEF_TC_se_foo_flex_appl_adapterinterface_dc_C_DynamicAttribu
te)
#define
TC_DEF_TC_se_foo_flex_appl_adapterinterface_dc_C_DynamicAttribute 1
static const char *anon_subnames_array46[] =
   { "id", "name", "dataType", "format", "value", "comparisonOperator"
};
static const CORBA_TypeCode anon_subtypes_array47[] =
   { (CORBA_TypeCode) & TC_CORBA_long_struct,
(CORBA_TypeCode) & TC_CORBA_string_struct,
(CORBA_TypeCode) &
TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_struct,
(CORBA_TypeCode) &
TC_se_foo_flex_appl_adapterinterface_dc_C_KeyValuePair_struct,
(CORBA_TypeCode) & TC_CORBA_string_struct, (CORBA_TypeCode) &
TC_CORBA_long_struct };
#ifdef ORBIT_IDL_C_IMODULE
static
#endif
const struct CORBA_TypeCode_struct
   TC_se_foo_flex_appl_adapterinterface_dc_C_DynamicAttribute_struct = {
   {&ORBit_TypeCode_epv, ORBIT_REFCOUNT_STATIC},
   CORBA_tk_struct,
   0,
   0,
   4,
   0,
   6,
   (CORBA_TypeCode *) anon_subtypes_array47,
   CORBA_OBJECT_NIL,
   "C_DynamicAttribute",
   "IDL:se/foo/flex/appl/adapterinterface/dc/C_DynamicAttribute:1.0",
   (char **) anon_subnames_array46,
   NULL,
   -1,
   0,
   0, 0
};
#endif

/* Interface type data */


Does anyone have a clue how to solve this problem or where to look for a
solution? Appreciate any advice.

TIA

/Johan 


------------------------------------------------------------
Johan Antonsson
johan@antonsson.com
------------------------------------------------------------






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]