C++编译器无法识别成员函数和类型

And*_*dry 1 c++ compiler-errors class

今天是奇怪的事情的一天....有一个愚蠢的hpp文件和另一个愚蠢的cpp文件试图实现一个愚蠢的类.他们来了:

// HPP

#ifndef _WFQUEUE_MANAGER_PROXY_HPP_
#define _WFQUEUE_MANAGER_PROXY_HPP_

#include <iostream>
#include <string>

#include "workflow.hpp"
#include "wfqueue.hpp"

//-----------------------------------------------------------------------------
// Enum, struct, aliases
namespace middleware {
typedef struct {
    std::string proxy_ipaddr; /* IP address to manager */
    std::string proxy_port; /* Port to manager */
} WFProxyConfig;
}
//-----------------------------------------------------------------------------
// Class definitions
namespace middleware {
/*!
 * This class provides network interface to access the workflow queue. It is
 * important to notice that constructor is private in order to let a factory
 * perform such a work.
 */
class WFQueueManagerProxy : public WFQueue {
    /*!
     * To let factory build properly this object, we provide access to every
     * part of it.
     */
    friend class WFQueueProxyFactory;
private:
    /*!
     * Privately constructs the object. Default configuration with loopback
     * address and invalid port.
     */
    WFQueueManagerProxy();
public:
    /*!
     * Destructor
     */
    ~WFQueueManagerProxy();
    /*!
     * Enqueues a workflow.
     */
    void enqueue(const Workflow& workflow);
    /*!
     * Dequeues a workflow.
     */
    const Workflow& dequeue();
private:
    /*!
     * Privately constructs the object. Assigning configuration.
     */
    void ConfigureProxy(WFProxyConfig conf);
    /*!
     * Parameters for proxy.
     */
    WFProxyConfig _config;
}; /* WFQueueManagerProxy */
} /* middleware */

#endif
Run Code Online (Sandbox Code Playgroud)

在这里另一个

// CPP

#include "wfqueue_manager_proxy.hpp"

using namespace middleware;

//-----------------------------------------------------------------------------
// Constructors and destructor
/* Private constructor */
WFQueueManagerProxy::WFQueueManagerProxy() {
    (this->_config).proxy_ipaddr = "127.0.0.1";
    (this->_config).proxy_port = "0";
}
/* Destructor */
WFQueueManagerProxy::~WFQueueManagerProxy() {

}
//-----------------------------------------------------------------------------
// Public members
/* Enqueue */
void WFQueueManagerProxy::enqueue(const Workflow& workflow) {

}
/* Dequeue */
const Workflow& WFQueueManagerProxy::dequeue() {

}
//-----------------------------------------------------------------------------
// Private members
void WFQueueManagerProxy::ConfigureProxy(WFProxyConfig conf) {

}
Run Code Online (Sandbox Code Playgroud)

有人请解释一下为什么g ++告诉我这个:

wfqueue_manager_proxy.cpp:在构造函数'middleware :: WFQueueManagerProxy :: WFQueueManagerProxy()'中:wfqueue_manager_proxy.cpp:32:错误:'class middleware :: WFQueueManagerProxy'没有名为'_config'的成员wfqueue_manager_proxy.cpp:33:错误:'class中间件:: WFQueueManagerProxy'没有名为'_config'的成员wfqueue_manager_proxy.cpp:在全局范围:wfqueue_manager_proxy.cpp:51:错误:变量或字段'ConfigureProxy'声明void wfqueue_manager_proxy.cpp:51:错误:'WFProxyConfig'未声明在这个范围内

ABSURD ...它不识别typedef并且也不识别私有成员......而且,不仅仅是一切......为什么g ++不能识别成员函数试图将其视为变量????? ????

我已经尝试了一切...... PS(谁看到我之前的帖子):我的虚拟机现在不是原因.我检查并确认没有虚拟硬盘损坏或与其他虚拟内存单元冲突.

Chu*_*dad 5

只是一个猜测.不应该

WFQueueManagerProxy::WFQueueManagerProxy() { 
    (this->_config).proxy_ipaddr = "127.0.0.1"; 
    (this->_config).proxy_port = "0"; 
} 
Run Code Online (Sandbox Code Playgroud)