开发者

new types may not be defined in a return type - C++

I am confused I think on C++ class structure.

I have a .h called FxMathFunctions.h and a .cpp called FxMathFunctions.cpp

the .h starts like:

class  FxMathFunctions
{
    public:
        FxMathFunctions();
        ~FxMathFunctions();

and in the .cpp

I have:

#include "FxBasicTypes.h"
#include "FxMathFunctions.h"

FxMathFunctions::FxMathFunctions() {}

FxMathFunctions::~FxMathFunctions() {}

I am getting errors like:

error: new types may not be defined in a return type
error: return type specification for constructor invalid

This must be something to do w开发者_C百科ith definition someplace, but I just dont see where this might occur.


What does your .h file end with? I'm guessing that the end of your class defnition does not have a ";". The class is being interpreted as the return type of the first function in your cpp file.


Losing ; in the end of class declaration could lead to such error.


Class declaration ends with a semicolon.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜