1
votes

Today it's the day of strange things.... Got a stupid hpp file and another stupid cpp file trying to implement a stupid class. Here they are:

// 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

Here the other

// 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) {

}

Somebody please explain me why g++ tells me this:

wfqueue_manager_proxy.cpp: In constructor ‘middleware::WFQueueManagerProxy::WFQueueManagerProxy()’: wfqueue_manager_proxy.cpp:32: error: ‘class middleware::WFQueueManagerProxy’ has no member named ‘_config’ wfqueue_manager_proxy.cpp:33: error: ‘class middleware::WFQueueManagerProxy’ has no member named ‘_config’ wfqueue_manager_proxy.cpp: At global scope: wfqueue_manager_proxy.cpp:51: error: variable or field ‘ConfigureProxy’ declared void wfqueue_manager_proxy.cpp:51: error: ‘WFProxyConfig’ was not declared in this scope

ABSURD... It does not recognize that typedef and doesn't recognize a private member too... and, more than everything... why does not g++ recognize a member function trying to see it as a variable?????????

I have tried everything... PS (to who saw my earlier post): my virtual machine now is not the cause. I checked and got confirm that no virtual hard disk is corrupted or in collision with other virtual mem units.

4
Using stub Workflow and WFQueue classes this compiles fine for me using g++ 4.2.1 and clang++ 2.8. - Nate

4 Answers

5
votes

Just a guess. Shouldn't it be

WFQueueManagerProxy::WFQueueManagerProxy() { 
    (this->_config).proxy_ipaddr = "127.0.0.1"; 
    (this->_config).proxy_port = "0"; 
} 
1
votes

I get the error you are getting when I remove the declaration of WFProxyConfig (or change the name declared). Are you sure you posted the exact code that is producing the error?

0
votes

Identifiers with leading underscores are reserved (include guards as well as _config). I'd be a little surprised if one of these is your problem - but not that surprised.

_config might even be a g++ extension keyword.

0
votes

OK, this was the error.... I also compiled headers.. many gch were so created.... g++ didn't update those precompiled headers and got an old code... that's why it was indifferent to any change I did... sorry for disturb you guys... thanks a lot for your help