关于创建NTL类类型

时间:2013-05-04 09:39:17

标签: c++

感谢您寻找

我试图创建一个类

long lPrime,lGenerator;
    lPrime = atol(vOut[1].c_str());
ZZ alicePrime;
    alicePrime = new ZZ(99999,lPrime);

我不确定INIT_VAL_TYPE要求我输入什么。

我收到了这个错误:

UDPEchoClient.cpp:85:34: error: no matching function for call to ‘NTL::ZZ::ZZ(int, long int&)’
UDPEchoClient.cpp:85:34: note: candidates are:
/sw/include/NTL/ZZ.h:113:1: note: NTL::ZZ::ZZ(NTL::ZZ&, NTL::INIT_TRANS_TYPE)
/sw/include/NTL/ZZ.h:113:1: note:   no known conversion for argument 1 from ‘int’ to ‘NTL::ZZ&’
/sw/include/NTL/ZZ.h:176:8: note: NTL::ZZ::ZZ(NTL::INIT_VAL_TYPE, double)
/sw/include/NTL/ZZ.h:176:8: note:   no known conversion for argument 1 from ‘int’ to ‘NTL::INIT_VAL_TYPE {aka const NTL::INIT_VAL_STRUCT&}’
/sw/include/NTL/ZZ.h:180:8: note: NTL::ZZ::ZZ(NTL::INIT_VAL_TYPE, float)
/sw/include/NTL/ZZ.h:180:8: note:   no known conversion for argument 1 from ‘int’ to ‘NTL::INIT_VAL_TYPE {aka const NTL::INIT_VAL_STRUCT&}’
/sw/include/NTL/ZZ.h:172:8: note: NTL::ZZ::ZZ(NTL::INIT_VAL_TYPE, const char*)
/sw/include/NTL/ZZ.h:172:8: note:   no known conversion for argument 1 from ‘int’ to ‘NTL::INIT_VAL_TYPE {aka const NTL::INIT_VAL_STRUCT&}’
/sw/include/NTL/ZZ.h:61:1: note: NTL::ZZ::ZZ(NTL::INIT_VAL_TYPE, unsigned int)
/sw/include/NTL/ZZ.h:61:1: note:   no known conversion for argument 1 from ‘int’ to ‘NTL::INIT_VAL_TYPE {aka const NTL::INIT_VAL_STRUCT&}’
/sw/include/NTL/ZZ.h:60:1: note: NTL::ZZ::ZZ(NTL::INIT_VAL_TYPE, long unsigned int)
/sw/include/NTL/ZZ.h:60:1: note:   no known conversion for argument 1 from ‘int’ to ‘NTL::INIT_VAL_TYPE {aka const NTL::INIT_VAL_STRUCT&}’
/sw/include/NTL/ZZ.h:58:1: note: NTL::ZZ::ZZ(NTL::INIT_VAL_TYPE, int)
/sw/include/NTL/ZZ.h:58:1: note:   no known conversion for argument 1 from ‘int’ to ‘NTL::INIT_VAL_TYPE {aka const NTL::INIT_VAL_STRUCT&}’
/sw/include/NTL/ZZ.h:57:1: note: NTL::ZZ::ZZ(NTL::INIT_VAL_TYPE, long int)
/sw/include/NTL/ZZ.h:57:1: note:   no known conversion for argument 1 from ‘int’ to ‘NTL::INIT_VAL_TYPE {aka const NTL::INIT_VAL_STRUCT&}’
/sw/include/NTL/ZZ.h:49:1: note: NTL::ZZ::ZZ(const NTL::ZZ&)
/sw/include/NTL/ZZ.h:49:1: note:   candidate expects 1 argument, 2 provided
/sw/include/NTL/ZZ.h:37:1: note: NTL::ZZ::ZZ(NTL::INIT_SIZE_TYPE, long int)
/sw/include/NTL/ZZ.h:37:1: note:   no known conversion for argument 1 from ‘int’ to ‘NTL::INIT_SIZE_TYPE {aka const NTL::INIT_SIZE_STRUCT&}’
/sw/include/NTL/ZZ.h:33:1: note: NTL::ZZ::ZZ()
/sw/include/NTL/ZZ.h:33:1: note:   candidate expects 0 arguments, 2 provided

1 个答案:

答案 0 :(得分:0)

首先new是错误的。你没有分配一个对象,你正在构建一个对象。

其次,假设我正在阅读头文件,并假设我明白你想要做什么,你只想要

ZZ alicePrime(INIT_VAL, lPrime);

INTI_VAL只是一个常量,它强制编译器选择给alicePrime初始值的构造函数,而不是初始位大小。

NTL文档很差。