Error C2998: & #39; XXXXXXX & #39;: possible cause of cannot be a template definition.

Source: Internet
Author: User

From the literal meaning of the error message, XXXXX cannot be defined as a template.

But why not? I did not explain why. Finally, I looked at various materials. After various attempts, I found that it was often caused by the failure to find a parameter definition of the template function.

1 template <typename T> 2 BOOL Func (T & t_vaule, MyStruct & st );

If you do not define the MyStruct struct or forget to introduce the MyStruct header file, the above function reports the C2998 error.

If some STL containers are used for a parameter of your template function, do not forget to introduce the corresponding header file or add the namespace std.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.