0

我有这段代码(来自https://github.com/nodejs/nan/tree/master/examples/async_pi_estimate

class PiWorker : public NanAsyncWorker {
public:
    PiWorker( NanCallback *callback, NanUtf8String sz_QMN )
    : NanAsyncWorker( callback ) {}     
    ~PiWorker() {}

void Execute() {
    printf( "(cc)>>>> qmn [%s].\n", sz_QMN ) ; .... line 52

...编译器说

..\mqconn.cc(52): error C2065: 'sz_QMN' : undeclared identifier

怎么会这样 ?

4

1 回答 1

0

您是否声明sz_QMN为私人会员?
从 nan 示例中,该Execute()函数仅访问私有成员。
您可以在构造函数中初始化sz_QMN私有成员:

public:
PiWorker(NanCallback *callback, NanUtf8String sz_QMN)
: NanAsyncWorker(callback), sz_QMN(sz_QMN) {}
于 2015-07-16T17:46:43.363 回答