E2141 Declaration syntax error

setdefault 2005-01-27 10:18:34
.h中定义:
typedef struct _st_CylindricalCoordinate{
float z,
r,
angle;
}st_CylindricalCoordinate;
class TSAR{
st_CylindricalCoordinate FindPoint(
st_CylindricalCoordinate *StartPoint,
float Step,
enum_ShiftDirection ShiftDirection
);

};

.cpp中

st_CylindricalCoordinate TSAR::FindPoint( //本行TSAR处出错
st_CylindricalCoordinate *StartPoint,
float Step,
enum_ShiftDirection ShiftDirection
)
{
...
}

为什么会?谁能帮办我?
我把返回值改成bool类型就没有错误
...全文
525 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
setdefault 2005-01-27
  • 打赏
  • 举报
回复
找到原因了。3996906(以后再说),是我描述有误,我把typedef struct _st_CylindricalCoordinate{
float z,
r,
angle;
}st_CylindricalCoordinate;定义在类内部了。
在实现的时候这样写就行:
TSAR::st_CylindricalCoordinate TSAR::FindPoint(....)
{
....
}
setdefault 2005-01-27
  • 打赏
  • 举报
回复
是啊,3996906(以后再说),我也做了相同的事,结果一样。
我原来是返回bool类型,今天改成这样的结构就出现这个问题。确实不知怎么办?郁闷
建议一下那儿可能会导致这样的错误?
3996906 2005-01-27
  • 打赏
  • 举报
回复
.h
//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
//---------------------------------------------------------------------------
typedef struct _st_CylindricalCoordinate{
float z,
r,
angle;
}st_CylindricalCoordinate;

enum enum_ShiftDirection {};

class TForm1 : public TForm
{
__published: // IDE-managed Components
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};

class TSAR{
st_CylindricalCoordinate FindPoint(
st_CylindricalCoordinate *StartPoint,
float Step,
enum_ShiftDirection ShiftDirection
);

};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif

.cpp
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
st_CylindricalCoordinate TSAR::FindPoint( //本行TSAR处出错
st_CylindricalCoordinate *StartPoint,
float Step,
enum_ShiftDirection ShiftDirection
)
{
//
}

偶不会出错~~~~~~~~~~郁闷

13,824

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧