我在编译具有嵌套在其他模板化类中的模板化类的代码时遇到了问题。名为MyClass
的主要模板类有50个模板参数,接受一个名为null_type_nn
的默认类类型,不执行任何特定操作。
我的模板参数以“_”字符开头,如下所示
template<
class T0=null_type_0
, class T1=null_type_1
, ...
, class T50=null_type_50
> MyClass;
typedef MyClass< _MyClassB, _MyClassC > _MyClass1;
typedef MyClass< _MyClassD, _MyClassE > _MyClass2;
.....
typedef MyClass< _MyClass1, _MyClass2, _MyClass3 , ..._MyClass50> my_type_a;
如果我没有调用该类的某个成员函数,我没有下面的错误;如果我只构造一条消息,然后访问/使用其中一个数据成员,我没有问题。
我能做些什么来解决它或帮助编译器完成工作?
: Assembler messages:
:8851: Error: symbol `_ZN12mine_structIL10EncodingID5015ELS0_1011E11
AsciiStringLS0_1115E23AsciiAlphaNumericStringLS0_1130ES2_LS0_1019E6S
Int16LS0_1066ES2_LS0_5030E11mine_unionILm1ES_ILS0_5042ELS0_15ES1_
LS0_16404E11mine_arrayILm4ES_ILS0_20ELS0_18ES2_LS0_1078ES3_LS0_2ES3_
LS0_19E5Dec32LS0_16E6SInt32LS0_64005E12mine_null_5LS0_64006E12
mine_null_6LS0_64007E12mine_null_7LS0_64008E12mine_null_8LS0_64009E12
mine_null_9LS0_64010E13mine_null_10LS0_64011E13mine_null_11LS0_64012E13
mine_n...// continues..it is a very big error!
完整的错误日志如下
: Assembler messages:
:972: Error: symbol
_ZN12main_structIL10EncodingID5067ELS0_5037ES_ILS0_5037ELS0_1099E6SInt16LS0_1059ES1_LS0_1036E6SInt64LS0_1037ES2_LS0_1089E6SInt32LS0_1070E10ByteStreamLS0_1095ES3_LS0_1183ES2_LS0_1184ES2_LS0_64009E12main_null_9LS0_64010E13main_null_10LS0_64011E13main_null_11LS0_64012E13main_null_12LS0_64013E13main_null_13LS0_64014E13main_null_14LS0_64015E13main_null_15LS0_64016E13main_null_16LS0_64017E13main_null_17LS0_64018E13main_null_18LS0_64019E13main_null_19LS0_64020E13main_null_20LS0_64021E13main_null_21LS0_64022E13main_null_22LS0_64023E13main_null_23LS0_64024E13main_null_24LS0_64025E13main_null_25LS0_64026E13main_null_26LS0_64027E13main_null_27LS0_64028E13main_null_28LS0_64029E13main_null_29LS0_64030E13main_null_30LS0_64031E13main_null_31LS0_64032E13main_null_32LS0_64033E13main_null_33LS0_64034E13main_null_34LS0_64035E13main_null_35LS0_64036E13main_null_36LS0_64037E13main_null_37LS0_64038E13main_null_38LS0_64039E13main_null_39LS0_64040E13main_null_40LS0_64041E13main_null_41LS0_64042E13main_null_42LS0_64043E13main_null_43LS0_64044E13main_null_44LS0_64045E13main_null_45LS0_64046E13main_null_46LS0_64047E13main_null_47LS0_64048E13main_null_48ELS0_21449E11main_unionILm50ES_ILS0_5016ELS0_1038ES3_LS0_1118ES3_LS0_1017ES3_LS0_1051ES3_LS0_1048ES3_LS0_1014E4DateLS0_1087ES3_LS0_1159ES2_LS0_1008E11AsciiStringLS0_21468E11main_arrayILm4ES_ILS0_5084ELS0_1179ES1C_LS0_1180E23AsciiAlphaNumericStringLS0_64002E12main_null_2LS0_64003E12main_null_3LS0_64004E12main_null_4LS0_64005E12main_null_5LS0_64006E12main_null_6LS0_64007E12main_null_7LS0_64008E12main_null_8LS0_64009ES5_LS0_64010ES6_LS0_64011ES7_LS0_64012ES8_LS0_64013ES9_LS0_64014ESA_LS0_64015ESB_LS0_64016ESC_LS0_64017ESD_LS0_64018ESE_LS0_64019ESF_LS0_64020ESG_LS0_64021ESH_LS0_64022ESI_LS0_64023ESJ_LS0_64024ESK_LS0_64025ESL_LS0_64026ESM_LS0_64027ESN_LS0_64028ESO_LS0_64029ESP_LS0_64030ESQ_LS0_64031ESR_LS0_64032ESS_LS0_64033EST_LS0_64034ESU_LS0_64035ESV_LS0_64036ESW_LS0_64037ESX_LS0_64038ESY
:8191: Error: symbol
_ZN12main_structIL10EncodingID5067ELS0_5037ES_ILS0_5037ELS0_1099E6SInt16LS0_1059ES1_LS0_1036E6SInt64LS0_1037ES2_LS0_1089E6SInt32LS0_1070E10ByteStreamLS0_1095ES3_LS0_1183ES2_LS0_1184ES2_LS0_64009E12main_null_9LS0_64010E13main_null_10LS0_64011E13main_null_11LS0_64012E13main_null_12LS0_64013E13main_null_13LS0_64014E13main_null_14LS0_64015E13main_null_15LS0_64016E13main_null_16LS0_64017E13main_null_17LS0_64018E13main_null_18LS0_64019E13main_null_19LS0_64020E13main_null_20LS0_64021E13main_null_21LS0_64022E13main_null_22LS0_64023E13main_null_23LS0_64024E13main_null_24LS0_64025E13main_null_25LS0_64026E13main_null_26LS0_64027E13main_null_27LS0_64028E13main_null_28LS0_64029E13main_null_29LS0_64030E13main_null_30LS0_64031E13main_null_31LS0_64032E13main_null_32LS0_64033E13main_null_33LS0_64034E13main_null_34LS0_64035E13main_null_35LS0_64036E13main_null_36LS0_64037E13main_null_37LS0_64038E13main_null_38LS0_64039E13main_null_39LS0_64040E13main_null_40LS0_64041E13main_null_41LS0_64042E13main_null_42LS0_64043E13main_null_43LS0_64044E13main_null_44LS0_64045E13main_null_45LS0_64046E13main_null_46LS0_64047E13main_null_47LS0_64048E13main_null_48ELS0_21449E11main_unionILm50ES_ILS0_5016ELS0_1038ES3_LS0_1118ES3_LS0_1017ES3_LS0_1051ES3_LS0_1048ES3_LS0_1014E4DateLS0_1087ES3_LS0_1159ES2_LS0_1008E11AsciiStringLS0_21468E11main_arrayILm4ES_ILS0_5084ELS0_1179ES1C_LS0_1180E23AsciiAlphaNumericStringLS0_64002E12main_null_2LS0_64003E12main_null_3LS0_64004E12main_null_4LS0_64005E12main_null_5LS0_64006E12main_null_6LS0_64007E12main_null_7LS0_64008E12main_null_8LS0_64009ES5_LS0_64010ES6_LS0_64011ES7_LS0_64012ES8_LS0_64013ES9_LS0_64014ESA_LS0_64015ESB_LS0_64016ESC_LS0_64017ESD_LS0_64018ESE_LS0_64019ESF_LS0_64020ESG_LS0_64021ESH_LS0_64022ESI_LS0_64023ESJ_LS0_64024ESK_LS0_64025ESL_LS0_64026ESM_LS0_64027ESN_LS0_64028ESO_LS0_64029ESP_LS0_64030ESQ_LS0_64031ESR_LS0_64032ESS_LS0_64033EST_LS0_64034ESU_LS0_64035ESV_LS0_64036ESW_LS0_64037ESX_LS0_64038ESY
make: * [unpack_test] Error 1
答案 0 :(得分:3)
来自C ++ 2003 Standard:
17.4.3.2.1全局名称[lib.global.names]
始终保留某些名称和功能签名集 实施:
每个包含双下划线(_ _)或以。开头的名称 下划线后跟一个大写字母(2.11)保留给 实施任何用途。
_MyClassB
,_MyClassC
...是保留名称。