创建向量
我基本上需要创建一个 MyClass 对象的列表。我认为最好的方法是编写 vector
但是,在编译时出现以下错误
error C2065: 'MyClass' : undeclared identifier
为什么会这样? c++
谢谢 托马斯
I need to basically create a list of MyClass objects. I thought the best way of doing this would be to write vector<MyClass> myClassList;
however when compiling I am presented with the following error
error C2065: 'MyClass' : undeclared identifier
Why is this so?
c++
Thanks
Thomas
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
那么,是哪个?
myClass
还是MyClass
?无论如何,正如它所说,此错误消息意味着
MyClass
尚未声明。您需要在使用类之前定义它。您要么没有定义它,要么忘记包含正确的标头,要么犯了一些类似的错误。Well, which is it?
myClass
orMyClass
?In any case, this error message means, as it says, that
MyClass
has not yet been declared. You need to define your class before you use it. You either haven't defined it or you've forgotten to include the right headers, or you have made some similar error.