.h中使用的模板类,该模板类已链接到C文件 [英] template class used in .h which is been linked to C files

查看:63
本文介绍了.h中使用的模板类,该模板类已链接到C文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


iam在.h文件中使用模板类对象,并且此.h文件与manc c和​​c ++文件链接.
现在进行编译时,C连接出错.

请帮助我解决这个问题或其他变通办法,以便我可以在此.h文件中使用模板类对象.

感谢

Hi,
iam using a template class object in a .h file and this .h file is linked with manc c and c++ files.
Now on compilation it is giving error for C linkage.

Please help me on this as how to come out of this or any other work around so that i can use my template class object in this .h file.

thanks

推荐答案

在头文件中,您可以使用:
In your header file, you may use:
#ifdef __cplusplus

// template class definition here

#endif // __cluplusplus


:)


template是C ++语言的功能.
C语言无法识别它.
template is a feature of the C++ language.
It is not recognized by the C language.


请问什么是"C"文件? :)
What is a "C" file please ?? :)


这篇关于.h中使用的模板类,该模板类已链接到C文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆