错误C2059:语法错误“常量” [英] Error C2059: syntax error 'constant'

查看:1071
本文介绍了错误C2059:语法错误“常量”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在头文件中有以下代码:

I have the following code in a header file:

enum {false,true};

我在main.c中有我的main函数。如果我将扩展更改为main.cpp
我得到以下错误:

and I have my main function in main.c. if I change the extention to main.cpp I get the following error:

Error C2059: syntax error 'constant' 

Im使用视觉c ++,任何想法为什么?

Im using visual c++, any Idea why`?

推荐答案

true false C ++。

例如,以下将编译

enum { false_, true_ };

int main() {}

这篇关于错误C2059:语法错误“常量”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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