vc error

写个vc 6 中的控制台程序,出现一些错误,及解决过程。

 

 

如下顺序引用头文件

#include "gzip.h"

#include <io.h>//_finddata_t, _findfirst(), _findnext(), _findclose()
#include <stdlib.h>//_MAX_PATH, system()
#include "stdafx.h"
#include <stdio.h>

程序中调用

::::DeleteFile(dFileName);

出现错误,DeleteFile is not a member  of global namespace。

加上#include <windows.h>就不出错了

 

但是出现下面错误

--------------------Configuration: gzipdemo - Win32 Debug--------------------
Compiling...
gzipdemo.cpp
 _Adding zlib library
e:/program files/microsoft visual studio/vc98/include/winnt.h(195) : error C2143: syntax error : missing ';' before '*'
e:/program files/microsoft visual studio/vc98/include/winnt.h(195) : error C2040: 'TCHAR' : 'char *' differs in levels of indirection from 'char'
e:/program files/microsoft visual studio/vc98/include/winnt.h(195) : error C2059: syntax error : ';'
e:/program files/microsoft visual studio/vc98/include/winnt.h(196) : error C2143: syntax error : missing ';' before '*'
e:/program files/microsoft visual studio/vc98/include/winnt.h(196) : error C2373: 'TCHAR' : redefinition; different type modifiers
        e:/program files/microsoft visual studio/vc98/include/tchar.h(640) : see declaration of 'TCHAR'
e:/program files/microsoft visual studio/vc98/include/winnt.h(196) : error C2059: syntax error : ';'
Error executing cl.exe.

gzipdemo.exe - 6 error(s), 0 warning(s)

都是系统自带文件,怎么会出误呢。

终于发现个办法,把#include "gzip.h"放到最后,也即写成

如下顺序引用头文件

 

#include <io.h>//_finddata_t, _findfirst(), _findnext(), _findclose()
#include <stdlib.h>//_MAX_PATH, system()
#include "stdafx.h"
#include <stdio.h>

#include "gzip.h"

蛮奇怪的

 

更奇怪的是编译通过一次后,再把#include "gzip.h"放回原处,也即又放到stdio.h等之前,也不报错了。

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值