| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 784 人关注过本帖
标题:初学者请高手赐教
只看楼主 加入收藏
孤独的求索者
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2014-11-18
结帖率:0
收藏
 问题点数:0 回复次数:2 
初学者请高手赐教
#include <iostream>
using namespace std;
class myclass
{
  static int n;
public:
    myclass()  {n+=1;}
    void disp()  {cout<<"n="<<n<<nedl;}

};
int myclass::n=0;
void main ()
{
 myclass *p= new myclass,s[4];
 p->disp();
}

为什么运行不了呢?1>------ 已启动生成: 项目: 静态数据, 配置: Debug Win32 ------
1>生成启动时间为 2014/11/23 16:11:14。
1>InitializeBuildStatus:
1>  正在对“Debug\静态数据.unsuccessfulbuild”执行 Touch 任务。
1>ClCompile:
1>  静态数据.c
1>d:\vs.study\vc\include\cmath(19): error C2061: 语法错误: 标识符“acosf”
1>d:\vs.study\vc\include\cmath(19): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(19): error C2061: 语法错误: 标识符“asinf”
1>d:\vs.study\vc\include\cmath(19): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(20): error C2061: 语法错误: 标识符“atanf”
1>d:\vs.study\vc\include\cmath(20): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(20): error C2061: 语法错误: 标识符“atan2f”
1>d:\vs.study\vc\include\cmath(20): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(20): error C2061: 语法错误: 标识符“ceilf”
1>d:\vs.study\vc\include\cmath(20): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(21): error C2061: 语法错误: 标识符“cosf”
1>d:\vs.study\vc\include\cmath(21): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(21): error C2061: 语法错误: 标识符“coshf”
1>d:\vs.study\vc\include\cmath(21): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(21): error C2061: 语法错误: 标识符“expf”
1>d:\vs.study\vc\include\cmath(21): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(22): error C2061: 语法错误: 标识符“fabsf”
1>d:\vs.study\vc\include\cmath(22): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(22): error C2061: 语法错误: 标识符“floorf”
1>d:\vs.study\vc\include\cmath(22): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(22): error C2061: 语法错误: 标识符“fmodf”
1>d:\vs.study\vc\include\cmath(22): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(23): error C2061: 语法错误: 标识符“frexpf”
1>d:\vs.study\vc\include\cmath(23): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(23): error C2061: 语法错误: 标识符“ldexpf”
1>d:\vs.study\vc\include\cmath(23): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(23): error C2061: 语法错误: 标识符“logf”
1>d:\vs.study\vc\include\cmath(23): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(24): error C2061: 语法错误: 标识符“log10f”
1>d:\vs.study\vc\include\cmath(24): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(24): error C2061: 语法错误: 标识符“modff”
1>d:\vs.study\vc\include\cmath(24): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(24): error C2061: 语法错误: 标识符“powf”
1>d:\vs.study\vc\include\cmath(24): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(25): error C2061: 语法错误: 标识符“sinf”
1>d:\vs.study\vc\include\cmath(25): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(25): error C2061: 语法错误: 标识符“sinhf”
1>d:\vs.study\vc\include\cmath(25): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(25): error C2061: 语法错误: 标识符“sqrtf”
1>d:\vs.study\vc\include\cmath(25): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(26): error C2061: 语法错误: 标识符“tanf”
1>d:\vs.study\vc\include\cmath(26): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(26): error C2061: 语法错误: 标识符“tanhf”
1>d:\vs.study\vc\include\cmath(26): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(28): error C2061: 语法错误: 标识符“acosl”
1>d:\vs.study\vc\include\cmath(28): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(28): error C2061: 语法错误: 标识符“asinl”
1>d:\vs.study\vc\include\cmath(28): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(29): error C2061: 语法错误: 标识符“atanl”
1>d:\vs.study\vc\include\cmath(29): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(29): error C2061: 语法错误: 标识符“atan2l”
1>d:\vs.study\vc\include\cmath(29): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(29): error C2061: 语法错误: 标识符“ceill”
1>d:\vs.study\vc\include\cmath(29): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(30): error C2061: 语法错误: 标识符“cosl”
1>d:\vs.study\vc\include\cmath(30): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(30): error C2061: 语法错误: 标识符“coshl”
1>d:\vs.study\vc\include\cmath(30): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(30): error C2061: 语法错误: 标识符“expl”
1>d:\vs.study\vc\include\cmath(30): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(31): error C2061: 语法错误: 标识符“fabsl”
1>d:\vs.study\vc\include\cmath(31): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(31): error C2061: 语法错误: 标识符“floorl”
1>d:\vs.study\vc\include\cmath(31): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(31): error C2061: 语法错误: 标识符“fmodl”
1>d:\vs.study\vc\include\cmath(31): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(32): error C2061: 语法错误: 标识符“frexpl”
1>d:\vs.study\vc\include\cmath(32): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(32): error C2061: 语法错误: 标识符“ldexpl”
1>d:\vs.study\vc\include\cmath(32): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(32): error C2061: 语法错误: 标识符“logl”
1>d:\vs.study\vc\include\cmath(32): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(33): error C2061: 语法错误: 标识符“log10l”
1>d:\vs.study\vc\include\cmath(33): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(33): error C2061: 语法错误: 标识符“modfl”
1>d:\vs.study\vc\include\cmath(33): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(33): error C2061: 语法错误: 标识符“powl”
1>d:\vs.study\vc\include\cmath(33): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(34): error C2061: 语法错误: 标识符“sinl”
1>d:\vs.study\vc\include\cmath(34): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(34): error C2061: 语法错误: 标识符“sinhl”
1>d:\vs.study\vc\include\cmath(34): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(34): error C2061: 语法错误: 标识符“sqrtl”
1>d:\vs.study\vc\include\cmath(34): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(35): error C2061: 语法错误: 标识符“tanl”
1>d:\vs.study\vc\include\cmath(35): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(35): error C2061: 语法错误: 标识符“tanhl”
1>d:\vs.study\vc\include\cmath(35): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(37): error C2061: 语法错误: 标识符“abs”
1>d:\vs.study\vc\include\cmath(37): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(39): error C2061: 语法错误: 标识符“acos”
1>d:\vs.study\vc\include\cmath(39): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(39): error C2061: 语法错误: 标识符“asin”
1>d:\vs.study\vc\include\cmath(39): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(40): error C2061: 语法错误: 标识符“atan”
1>d:\vs.study\vc\include\cmath(40): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(40): error C2061: 语法错误: 标识符“atan2”
1>d:\vs.study\vc\include\cmath(40): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(40): error C2061: 语法错误: 标识符“ceil”
1>d:\vs.study\vc\include\cmath(40): error C2059: 语法错误:“;”
1>d:\vs.study\vc\include\cmath(41): error C2061: 语法错误: 标识符“cos”
1>d:\vs.study\vc\include\cmath(41): fatal error C1003: 错误计数超过 100;正在停止编译
1>
1>生成失败。
1>
1>已用时间 00:00:00.27
========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========
搜索更多相关主题的帖子: include public Touch 项目 
2014-11-23 16:15
猫林heart
Rank: 5Rank: 5
等 级:职业侠客
威 望:1
帖 子:60
专家分:390
注 册:2014-9-26
收藏
得分:0 
你的代码有两处错误,第一 cout<<"n="<<n<<nedl;其中该语句中nedl是endl拼写错误,第二C++语法要求main函数的定义必须是以函数头int main()开始。main();或void main();是C语言的用法。
2014-11-23 21:27
zklhp
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:china
等 级:贵宾
威 望:254
帖 子:11485
专家分:33241
注 册:2007-7-10
收藏
得分:0 
以下是引用猫林heart在2014-11-23 21:27:35的发言:

你的代码有两处错误,第一 cout<<"n="<

main();或void main();是C语言的用法。

这样在C里面也是不规范的
2014-11-23 21:56
快速回复:初学者请高手赐教
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.021070 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved