24小时热门版块排行榜    

查看: 1880  |  回复: 13
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

zyj8119

木虫 (著名写手)


[交流] 【讨论】VC++与C语言

感觉有时候用VC++来编译C语言,总是有些莫名其妙的错误,各位也遇到过吗?
回复此楼

» 猜你喜欢

» 抢金币啦!回帖就可以得到:

查看全部散金贴

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

swyxgc

新虫 (初入文坛)


★ ★
zyj8119(金币+1):谢谢参与
cenwanglai(金币+1): 呵呵,传说中的神女? 2011-03-23 23:39:57
有时候VC++跑C的程序就会出错,比如两者在调用函数,继承等等方面有差别的
4楼2010-12-23 16:36:38
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 14 个回答

zyj8119

木虫 (著名写手)


引用回帖:
Originally posted by zyj8119 at 2010-11-14 03:34:20:
感觉有时候用VC++来编译C语言,总是有些莫名其妙的错误,各位也遇到过吗?

比如说下面这个C语言,明明没有错误,但是用VC编译总是会出现错误:
Compiling...
lllk.c
c:\documents and settings\administrator\桌面\cc\lllk.c(25) : error C2015: too many characters in constant
c:\documents and settings\administrator\桌面\cc\lllk.c(25) : error C2061: syntax error : identifier 'bachelor'
c:\documents and settings\administrator\桌面\cc\lllk.c(25) : error C2001: newline in constant
c:\documents and settings\administrator\桌面\cc\lllk.c(27) : error C2065: 'sortkey' : undeclared identifier
c:\documents and settings\administrator\桌面\cc\lllk.c(27) : warning C4047: 'function' : 'char ** ' differs in levels of indirection from 'int '
c:\documents and settings\administrator\桌面\cc\lllk.c(27) : warning C4024: 'sort' : different types for formal and actual parameter 3
Error executing cl.exe.

lllk.obj - 4 error(s), 2 warning(s)
程序为:
CODE:
#include
#include
#include




typedef struct
{  char name[10];char degree[10];}ST;

void sort(ST x[],int n,char *key[],int m)
{    int i,j,k,con1,con2; ST v;
     for(i=0;i                  for(j=0;j                  {   for(k=0;k                        if(strcmp(x[j].degree,key[k])==0)
                           {   con1=k;break;}
                           for(k=0;k                                    if(strcmp(x[j+1].degree,key[k])==0){ con2=k;break;}
                                   if(con1>con2||con1==con2&&strcmp(x[j].name,x[j+1].name)>0)
                                   {v=x[j];x[j]=x[j+1];x[j+1]=v;}
                 }
}

void main()
{  ST s[5]={{"A","master"},{"B","bachelor"},{"C",'doctor"},{"D",'bachelor"},{"E","master"}};
   char *sortkey[]={"bachelor","master","doctor"};int i;
   sort(s,5,sortkey,3);
   for(i=0;i<5;i++)
   printf("\n%s %s",s[i].name,s[i].degree);
   getch();
}

2楼2010-11-14 03:37:40
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

zyj8119

木虫 (著名写手)


引用回帖:
Originally posted by zyj8119 at 2010-11-14 03:37:40:

比如说下面这个C语言,明明没有错误,但是用VC编译总是会出现错误:
Compiling...
lllk.c
c:\documents and settings\administrator\桌面\cc\lllk.c(25) : error C2015: too many characters in constant
c ...

找到错误了,谢谢。此贴结贴。。。
3楼2010-11-14 13:26:40
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

siqin123

新虫 (正式写手)



zyj8119(金币+1):谢谢参与
还有一些接口也不一样
5楼2010-12-30 16:38:46
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
普通表情 高级回复 (可上传附件)
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 275求调剂 +5 明远求学 2026-03-01 5/250 2026-03-02 18:19 by lature00
[考研] 283求调剂 +3 鹿沫笙 2026-03-02 3/150 2026-03-02 18:10 by barlinike
[考研] 085600 英一数二272求调剂 5+5 vida_a 2026-03-01 14/700 2026-03-02 17:45 by barlinike
[考研] 289求调剂 +3 BrightLL 2026-03-02 3/150 2026-03-02 17:28 by 杨杨杨紫
[考研] 一志愿东北大学材料专硕328,求调剂 +3 shs1083 2026-03-02 3/150 2026-03-02 17:27 by houyaoxu
[考研] 085600求调剂 +3 LRZZZZZZ 2026-03-02 3/150 2026-03-02 16:58 by zeng1010
[考研] 材料284求调剂,一志愿郑州大学英一数二专硕 +12 想上岸的土拨鼠 2026-02-28 12/600 2026-03-02 16:18 by youmomaoyan
[考研] 材料与化工328求调剂 +3 。,。,。,。i 2026-03-02 3/150 2026-03-02 13:09 by houyaoxu
[基金申请] 面上模板改不了页边距吧? +6 ieewxg 2026-02-25 7/350 2026-03-02 12:44 by stidwellNK
[考研] 材料工程274求调剂 +4 Lilithan 2026-03-01 4/200 2026-03-02 12:06 by yuchj
[考研] 265分求调剂不调专业和学校有行学上就 +6 礼堂丁真258 2026-02-28 9/450 2026-03-02 12:04 by 52hz~~
[考研] 276求调剂 +4 路lyh123 2026-02-28 5/250 2026-03-02 11:20 by yuchj
[考研] 284求调剂 +10 天下熯 2026-02-28 11/550 2026-03-02 11:03 by 无际的草原
[考研] 一志愿郑大材料学硕298分,求调剂 +6 wsl111 2026-03-01 6/300 2026-03-02 11:00 by ydudjddnd
[硕博家园] 博士自荐 +7 科研狗111 2026-02-26 11/550 2026-03-01 22:24 by 哲平L
[考研] 298求调剂 +6 axyz3 2026-02-28 6/300 2026-03-01 19:00 by 18137688336
[考研] 一志愿中南大学理学化学 +4 15779376950 2026-03-01 5/250 2026-03-01 19:00 by Fff-1
[考研] 0856材料求调剂 +4 麻辣鱿鱼 2026-02-28 4/200 2026-03-01 16:51 by caszguilin
[基金申请] 刚录用,没有期刊号,但是在线可看的论文可以放为代表作吗 10+3 arang1 2026-03-01 3/150 2026-03-01 16:43 by babero
[考研] 302材料工程求调剂 +4 Doleres 2026-03-01 5/250 2026-03-01 11:52 by liqiongjy
信息提示
请填处理意见