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:
- 打开
项目设置
>C / C ++
>一般
。 - 修改调试信息格式属性。
- Open
Project Settings
>C/C++
>General
. - Modify the Debug Information Format property.