C++ - 树作业上的编译错误:错误:预期的构造函数、析构函数或类型转换在“*”之前代币
我目前正在尝试做作业,并且我正在尝试首先编译我的东西(.h 文件中的类标头和 .inl 文件中的空定义(我正在使用 typename 模板) )。
我收到此错误:
error: expected constructor, destructor, or type conversion before ‘*’ token
这是我的 .h 文件: http://ideone.com/dm3Bp
这是我的 . inl 文件: http://ideone.com/5FBep
我正在尝试创建一个节点(称为 Noeud,在这些文件)位于 .inl 文件末尾。 显然,我无法从 E 数据类型的数组中获取值...
错误就在方法的定义之前:
Noeud * Arbre<E>::_auxPereSym(E *tabS, int debut, int fin, E **ptr, int &card) throw (std::bad_alloc)
我在其他线程中读到返回类型应该是 Arbre< E >::Noeud 因为 Noeud 是我的 Arbre 类的嵌套结构...但不幸的是,我无法更改头文件...
有什么想法吗?
感谢您的时间和帮助。
注意:如果需要翻译,请告诉我,这是一份法语作业。
I'm currently trying to do a homework, and I'm trying to get my things to compile at first (class headers in the .h file, and the empty definitions in the .inl file (I'm using the typename template)).
I'm getting this error :
error: expected constructor, destructor, or type conversion before ‘*’ token
Here's my .h file : http://ideone.com/dm3Bp
Here's my .inl file: http://ideone.com/5FBep
I'm trying to make a Node (called Noeud, in these files) at the end of the .inl file.
apparently, I can't take a value from array of type E data...
The error is just before the definition of the method:
Noeud * Arbre<E>::_auxPereSym(E *tabS, int debut, int fin, E **ptr, int &card) throw (std::bad_alloc)
I've read in other threads that the return type should be Arbre< E >::Noeud Because Noeud is a nested structure of my class Arbre... But unfortunately, I can't change the header file...
Any thoughts?
Thanks for you time and help.
Note: Let me know if a translation is needed for anything, this is a french homework.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试在 .inl 文件(而不是您所关心的头文件)中定义时进行限定。
需要在适当的范围内适当地查找返回类型。
BRAIN 提前编译代码
EDIT2:
将成员函数中的 return 语句更改为:
Try to qualify as so while defining in .inl file (and not the header file as per your concern).
The return type needs to be looked up in the proper scope appropriately.
BRAIN COMPILED CODE AHEAD
EDIT2:
change return statement in the member function as so: