开发者

c++ Why do I get "does not name a type" error?

In my main class I have:

#include "main.h"
outPut O;
int main(){
...
}

where the main.h file has #include "outPut.h"

the "outPut.h" line 开发者_StackOverflow社区has:

#ifndef OUTPUT_H
#define OUTPUT_H

#include <iostream>
#include <fstream>

    #include "properties.h"
    #include "particles.h"

    class outPut{
     public:
      outPut();
      std::ofstream file;
      void show(lipid * l);
    };

    #endif

and the outPut.cpp:

#include "outPut.h"

outPut::outPut(){
}

When I compile this I get the error:

main.cpp:3: error: ‘outPut’ does not name a type

Why so?

Thanks...

Edit, found it. main.h wasn't saved and the #include "outPut.h" was canceled.


You need to #include "outPut.h" in main.cpp.


grep for OUTPUT_H in all source files. You might have inadvertently defined the include guard in some other header which is included earlier than outPut.h.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜