Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7918305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:27:26+00:00 2026-06-03T15:27:26+00:00

I am using forward declaration and now I am getting an error referring to

  • 0

I am using forward declaration and now I am getting an error referring to the class that uses the forward declaration…so fInstance forward declares fConfig and then the Helper class (a namespace – used for global access to functions) – getting t

fConfig.h

#ifndef FCONFIG_H
#define FCONFIG_H

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <string>
#include <cstring>
#include <sys/types.h>
#include <fcntl.h>
#include "JWDSFork.h"
//#include "fInstance.h"

using namespace std;

class fConfig
{
    private:
        pid_t pid, w;

    public:
        pid_t cPid;
        string name;

        int group;
        int instanceId;
        int numInstance;
        int tries;

        bool reply;
        bool debug;
        bool service;
        bool currentlyRunning;

        time_t startTime;
        time_t endTime;

        string path;

        fConfig();
        virtual ~fConfig();

        void start();
        string intToString(int);
        char* stringToChar(string);
};

#endif // FCONFIG_H

fInstance.h

#ifndef FINSTANCE_H
#define FINSTANCE_H

//#include "fConfig.h"
#include <vector>
#include <sys/types.h>
#include <string>

using namespace std;

class fConfig;


class fInstance
{
public:

    fConfig* config;
    pid_t pid;
    vector<string> notes;
    vector<time_t> times;

    fInstance();
    virtual ~fInstance();


};

#endif // FINSTANCE_H

Helper.h

#ifndef HELPER_H
#define HELPER_H

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <sstream>
#include <limits.h>
#include "fInstance.h"

using namespace std;

namespace Helper
{
    extern string APPDIR;

    bool errorCheck(int, char*);
    string charToString(char*, int);
    string longToString(unsigned long);
    bool Contains(vector<fInstance>, fInstance);
    string convertInt(int);
    string convertDouble(double);
    bool Read(int, char*, size_t);
    bool Write(int, char*, size_t);
};

#endif // HELPER_H

Helper.cpp

//Helper.cpp - function that causes a problem
#include "Helper.h"
namespace Helper
{

bool Contains(vector<fInstance> a, fInstance b)
    {
        for(unsigned int i= 0; i < a.size(); i++ )
        {
            if(a[i].config.name == b.config.name)
            {
                return true;
            }
        }

        return false;
    }
}

I am getting these errors

error: request for member ‘name’ in ‘a.std::vector<_Tp, _Alloc>::operator[] [with _Tp = fInstance, _Alloc = std::allocator<fInstance>](((long unsigned int)i))->fInstance::config’, which is of non-class type ‘fConfig*’
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T15:27:28+00:00Added an answer on June 3, 2026 at 3:27 pm

    That’s a pretty unfriendly error message, but what it means is that the config member is a pointer, so you need to use the -> operator instead, ie.

     if(a[i].config->name == b.config->name)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that I can forward messages to instances of a class using -forwardInvocation:
I usually use forward declaration predominantly, if I have a class that does not
It's well known that using forward declarations is preferable to using #includes in header
I want to use the forward declaration for the ptree class of boost::property_tree .
When trying to use an auto_ptr with a type that was declared with forward-declaration,
C++0x shows an example of using std::forward : template<class T> void foo(T&& arg) {
Copying a File using a straight-forward approach in Python is typically like this: def
I'm using the following straight-forward jQuery implementation var soapMessage = '<soap:Envelope xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/>\ <soap:Body xmlns:ns1=http://site.com/>\
I am currently using the following to forward all incoming traffic to the cms
I am building a forward index on a wiki using MySQL. I am running

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.