VC ++:模板参数无效 [英] VC++ : Invalid template argument

查看:615
本文介绍了VC ++:模板参数无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在VS 2010中重建一个旧的VC ++项目。它目前吐出一个无效的模板参数错误。

I'm trying to rebuild an old VC++ project in VS 2010. Its currently spitting out an Invalid template argument error.

我必须添加 .template 关键字?在哪里?

Do I have to add a .template keyword? Where?

完整的错误如下:


错误C2975:'N ':ToChunkFunc的无效模板参数,预期的编译时常数表达式

Error C2975: 'N' : invalid template argument for ToChunkFunc, expected compile-time constant expression


推荐答案

__ LINE __ 关键字不可用时,可能会导致c $ c> C2975 。如果编辑并继续打开,编译器将使用 / ZI 选项运行,该选项可以创建程序数据库,而不是 PDB文件,在此模式下, __ LINE __ 常数不可用,因为行号可能在运行时更改。您需要使用支持 __ LINE __ 常量的 / Zi 命令行选项。

Error C2975 can be caused when the __LINE__ keyword is unavailable. If edit and continue is turned on, the compiler is run with the /ZI option which enables creation of a program database rather than a PDB file, in this mode the __LINE__ constant is unavailable because the line numbers can change at runtime. You'll need to use the /Zi command line option which has support for the __LINE__ constant.

要在VS IDE中设置此编译器选项:

To set this compiler option in the VS IDE:


  1. 打开项目设置> C / C ++ > 一般

  2. 修改调试信息格式属性。

  1. Open Project Settings > C/C++ > General.
  2. Modify the Debug Information Format property.

这篇关于VC ++:模板参数无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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