ffs没有在C++中命名类型

Asi*_*med 3 c++ types

当我尝试编译以下内容时出现编译错误.....请评论.

这是我的代码:ffs.h

#ifndef FFS_H
#define FFS_H
     #include <iostream>
        #include <string>
        #include "commands.h"

        class ffs{
        private:
            Filesystem *filesys;
            Superblock block;
            void processCommands(InputParser command);
            void performQuit();
            void performInit(InputParser command);

        public:
            void acceptCommands();
            ffs(){};
        };

        #endif 
Run Code Online (Sandbox Code Playgroud)

ffs.cpp

#include "ffs.h"

void ffs::acceptCommands(){
    std::string input;
    while(true){
        std::cout<< "Enter command : ";
        getline(std::cin,input);
        InputParser parser(input);
        processCommands(parser);
    }
}

void ffs::performInit(InputParser command){
    command.getCommand().pop_front();
    int n = atoi(command.getCommand().front().c_str());
    std::cout<< n << " : number of blocks "<<std::endl;
    command.getCommand().pop_front();
    int m = atoi(command.getCommand().front().c_str());
    std::cout<<m << " : number of inode blocks" << std::endl;
    command.getCommand().pop_front();
    block.ninode=m;
    Filesystem fs(n);       
    filesys = &fs;
}

void ffs::performQuit(){
    ///filesys->clean();
    exit(0);
}

void ffs::processCommands(InputParser command){
    std::string cmd=command.getCommandName();
    if(cmd.compare(commands::Q())==0) performQuit();
    else if (cmd.compare(commands::INIT())==0) performInit(command);
}
Run Code Online (Sandbox Code Playgroud)

tester.h

#ifndef TESTER_H
#define TESTER_H

#include "ffs.h"

class ffs;
class tester{
private: 
    ffs ffsobj;
public:
    void run(){ffsobj.acceptCommands()};
};

#endif
Run Code Online (Sandbox Code Playgroud)

tester.cpp

#include "tester.h"

int main()
{
    tester runner;
    runner.run();
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

错误:

  g++  -c -Wall tester.cpp
tester.h:7: error: ffs does not name a type
tester.h: In member function void tester::run():
tester.h:9: error: ffsobj was not declared in this scope
tester.h:9: error: expected `;' before ˜} token
make: *** [tester.o] Error 1
Run Code Online (Sandbox Code Playgroud)

Makefile文件:

CFLAGS=-c -Wall
CC=g++

all: flags.o InputParser.o commands.o Filesystem.o ffs.o tester.o
        $(CC) flags.o InputParser.o commands.o Filesystem.o ffs.o tester.o -o runner.o

flags.o : flags.cpp flags.h 
        $(CC)  $(CFLAGS) flags.cpp

InputParser.o :  InputParser.cpp InputParser.h
        $(CC)  $(CFLAGS) InputParser.cpp 

ffs.o: ffs.cpp ffs.h 
        $(CC)  $(CFLAGS) ffs.cpp

commands.o: commands.cpp commands.h
        $(CC)  $(CFLAGS) commands.cpp

Filesystem.o: Filesystem.cpp Filesystem.h Superblock.h
        $(CC)  $(CFLAGS) Filesystem.cpp

tester.o: tester.cpp tester.h ffs.o
        $(CC)  $(CFLAGS) tester.cpp

#fileUtility.o : IFileUtility.h 
#       gcc -c IFileUtility.h 
# Inode.h  commands.h Filesystem.h

clean :
        rm *.o
Run Code Online (Sandbox Code Playgroud)

Bet*_*eta 5

你不能使用它ffs作为你的类名,它已经在c ++中有意义(albiet是一个不起眼的名字).只需选择一个不同的名称.