博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
vc error
阅读量:4031 次
发布时间:2019-05-24

本文共 1629 字,大约阅读时间需要 5 分钟。

写个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等之前,也不报错了。

 

 

转载地址:http://taqbi.baihongyu.com/

你可能感兴趣的文章
当前主要目标和工作
查看>>
POJ 2363 Blocks(我的水题之路——立方体体积和表面积,暴力)
查看>>
POJ 2390 Bank Interest(我的水题之路——double和floa计算差别)
查看>>
POJ 2459 Feed Accounting(我的水题之路——英文题啊!!!)
查看>>
POJ 2470 Ambiguous permutation(我的水题之路——位置和值的队列)
查看>>
POJ 2498 StuPId(我的水题之路——from back to front- -!)
查看>>
POJ 2535 Very Simple Problem(我的水题之路——看错题)
查看>>
POJ 2538 WERTYU(我的水题之路——键盘错位)
查看>>
POJ 2551 Ones(我的水题之路——重点,末尾有几个1)
查看>>
POJ 2562 Primary Arithmetic(我的水题之路——模拟加法进位)
查看>>
POJ 2575 Jolly Jumpers(我的水题之路——数组绝对差值为1到n-1)
查看>>
POJ 2578 Keep on Truckin'(我的水题之路——谁先大于168)
查看>>
POJ 2579 Blurred Vision(我的水题之路——四方格平均值)
查看>>
POJ 2591 Set Definition(我的水题之路——又一个丑数)
查看>>
POJ 2606 Rabbit hunt(我的水题之路——斜率最多)
查看>>
POJ 2608 Soundex(我的水题之路——字符值)
查看>>
POJ 2636 Electrical Outlets(我的水题之路——水,电器接头)
查看>>
POJ 2656 Unhappy Jinjin(我的水题之路——不开心的学习日)
查看>>
POJ 2664 Prerequisites?(我的水题之路——选课)
查看>>
POJ 2665 Trees(我的水题之路——移树,POJ100题啦!)
查看>>