0

感谢您的关注

我试图创建一个类

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
4

1 回答 1

0

首先new是错误的。您不是在分配对象,而是在构造对象。

其次,假设我正在正确阅读头文件,并且假设我了解您要执行的操作,那么您只是想要

ZZ alicePrime(INIT_VAL, lPrime);

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

NTL 文档很差。

于 2013-05-04T09:58:07.053 回答