Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/149.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ ';QOAuth::接口&;QOAuth::Interface::operator=(const QOAuth::Interface&;)和#x27;是私人的_C++_Qt - Fatal编程技术网

C++ ';QOAuth::接口&;QOAuth::Interface::operator=(const QOAuth::Interface&;)和#x27;是私人的

C++ ';QOAuth::接口&;QOAuth::Interface::operator=(const QOAuth::Interface&;)和#x27;是私人的,c++,qt,C++,Qt,我正在尝试使用QOAuth,但收到以下错误: 错误:“QOAuth::Interface&QOAuth::Interface::operator=(const QOAuth::Interface&)”是私有的 我的源代码如下: 服务.h // ... class Service : public QObject { Q_OBJECT // ... private: QOAuth::Interface *qoauth; }; // ... service.cpp #inclu

我正在尝试使用QOAuth,但收到以下错误:

错误:“QOAuth::Interface&QOAuth::Interface::operator=(const QOAuth::Interface&)”是私有的

我的源代码如下:

服务.h

// ...
class Service : public QObject
{
    Q_OBJECT

// ...

private:
    QOAuth::Interface *qoauth;
};
// ...
service.cpp

#include "service.h"

Service::Service(QObject *parent) :
    QObject(parent)
{
*qoauth = new QOAuth::Interface;
}

QString Service::getAuthorizeUrl(QString consumerKey, QString consumerSecret){

    // set the consumer key and secret
    qoauth->setConsumerKey(consumerKey);
    qoauth->setConsumerSecret(bytes);

    // ...
}

void Service::accessToken(QString url) {
    // send a request to exchange Request Token for an Access Token
    QOAuth::ParamMap reply = qoauth->accessToken(url, QOAuth::POST, m_token, m_tokenSecret, QOAuth::HMAC_SHA1);

    // ...
}
我对指针理解不够,可能是因为


提前感谢。

*qoauth=newqoauth::Interface
不正确,因为
new
返回指向它应该是的对象的指针
qoauth=new qoauth::Interface

谢谢您,很抱歉回复太晚。我尝试了
qoauth=new qoauth::Interface
,然后编译器抱怨,例如
qoauth->setConsumerKey(consumerKey),“->”的基操作数具有非指针类型“qoauth::Interface”如果我更改它,点运算符和编译器会说“没有匹配的函数用于调用'QOAuth::Interface::setConsumerKey(QString&')”。哪个是正确的。。。?