VC驿站

 找回密码
 加入驿站

QQ登录

只需一步,快速开始

搜索
查看: 928|回复: 3

关于vc++ 6.0 报 error c2146的一个问题

[复制链接]
51_avatar_middle
最佳答案
0 
在线会员 发表于 2021-3-5 15:23:47 | 显示全部楼层 |阅读模式
先把代码贴上来

#include "stdafx.h"
#include "windows.h"

int WINAPI test1(int a,int b)
{
     return a+b;
}
int __fastcall test2(int a,int b)
{
            return a+b;
}
int PASCAL test3(int a,int b)
{
   return a+b;
}
int __stdcall test4(int a,int b)
{

            return a+b;
}
int test5(int a,int b)
{
            return a+b;
}

int main(int argc, char* argv[])
{
            test1(3,5);
            test2(3,5);
            test3(3,5);
            test4(3,5);
            test5(3,5);

        return 0;
}

报错如下:
--------------------Configuration: hanshu2 - Win32 Debug--------------------
Compiling...
hanshu2.cpp
c:\program files (x86)\microsoft visual studio\vc98\include\excpt.h(7) : error C2146: syntax error : missing ';' before identifier 'test1'
c:\program files (x86)\microsoft visual studio\vc98\include\excpt.h(7) : fatal error C1004: unexpected end of file found
执行 cl.exe 时出错.

hanshu2.exe - 1 error(s), 0 warning(s)

各位大佬帮忙看看这个问题出在哪里了,这串代码之前我是可以编译通过的,但是不知道为什么现在就不行了,去百度说是头文件的问题,但是按照百度的方法还没有解决。




上一篇:宏定义啥意思?为什么逗号前要加 _x
下一篇:64位进程 怎么遍历32+64位进程模块
51_avatar_middle
最佳答案
0 
ico_lz  楼主| 发表于 2021-3-5 22:40:23 | 显示全部楼层
发现原因了,就是在header files里面多出来一个excpt.h,然后不知道为什么里面的内容竟然被替换成我cpp程序的内容,把excpt.h还原成它本来的样子就好了

评分

参与人数 2驿站币 +3 热心值 +3 收起 理由
70_avatar_small tony666 + 1 + 1 很给力!
58_avatar_small thzzl + 2 + 2 赞一个!

查看全部评分

70_avatar_middle
最佳答案
49 
在线会员 发表于 2021-3-5 17:53:26 | 显示全部楼层
#include "stdafx.h" 删了
#include "windows.h" 改成 #include<windows.h>
试试
51_avatar_middle
最佳答案
0 
ico_lz  楼主| 发表于 2021-3-5 22:33:03 | 显示全部楼层
tony666 发表于 2021-3-5 17:53
#include "stdafx.h" 删了
#include "windows.h" 改成 #include
试试

还是不行,没有成功
您需要登录后才可以回帖 登录 | 加入驿站 qq_login

本版积分规则

×【发帖 友情提示】
1、请回复有意义的内容,请勿恶意灌水;
2、纯数字、字母、表情等无意义的内容系统将自动删除;
3、若正常回复后帖子被自动删除,为系统误删的情况,请重新回复其他正常内容或等待管理员审核通过后会自动发布;
4、感谢您对VC驿站一如既往的支持,谢谢合作!

关闭

站长提醒上一条 /2 下一条

QQ|小黑屋|手机版|VC驿站 ( 辽ICP备09019393号-4 )|网站地图wx_jqr

GMT+8, 2023-9-28 01:35

Powered by CcTry.CoM

© 2009-2021 cctry.com

快速回复 返回顶部 返回列表