关于vc下list.h的问题

diaolingle 2012-10-11 11:41:07
写链表操作,引入include "list.h",结果引发一大堆错误,提示如下:

c:\microsoft visual studio\vc98\include\list.h(37) : error C2061: syntax error : identifier 'DWORD'
c:\microsoft visual studio\vc98\include\list.h(38) : error C2059: syntax error : '}'
c:\microsoft visual studio\vc98\include\list.h(40) : error C2143: syntax error : missing '{' before '*'
c:\microsoft visual studio\vc98\include\list.h(53) : error C2061: syntax error : identifier 'GetPrevLink'
c:\microsoft visual studio\vc98\include\list.h(53) : error C2059: syntax error : ';'
c:\microsoft visual studio\vc98\include\list.h(53) : error C2059: syntax error : 'type'
c:\microsoft visual studio\vc98\include\list.h(58) : error C2061: syntax error : identifier 'GetNextLink'
c:\microsoft visual studio\vc98\include\list.h(58) : error C2059: syntax error : ';'
c:\microsoft visual studio\vc98\include\list.h(58) : error C2059: syntax error : 'type'
c:\microsoft visual studio\vc98\include\list.h(63) : error C2061: syntax error : identifier 'GetHeadOfList'
c:\microsoft visual studio\vc98\include\list.h(63) : error C2059: syntax error : ';'
c:\microsoft visual studio\vc98\include\list.h(63) : error C2146: syntax error : missing ')' before identifier 'List'
c:\microsoft visual studio\vc98\include\list.h(63) : error C2061: syntax error : identifier 'List'
c:\microsoft visual studio\vc98\include\list.h(63) : error C2059: syntax error : ')'
c:\microsoft visual studio\vc98\include\list.h(64) : error C2449: found '{' at file scope (missing function header?)
c:\microsoft visual studio\vc98\include\list.h(66) : error C2059: syntax error : '}'
c:\microsoft visual studio\vc98\include\list.h(73) : error C2061: syntax error : identifier 'WINAPI'
c:\microsoft visual studio\vc98\include\list.h(73) : error C2059: syntax error : ';'
c:\microsoft visual studio\vc98\include\list.h(73) : error C2146: syntax error : missing ')' before identifier 'List'
c:\microsoft visual studio\vc98\include\list.h(73) : error C2061: syntax error : identifier 'List'
c:\microsoft visual studio\vc98\include\list.h(73) : error C2059: syntax error : ';'
c:\microsoft visual studio\vc98\include\list.h(73) : error C2059: syntax error : ')'
c:\microsoft visual studio\vc98\include\list.h(74) : error C2449: found '{' at file scope (missing function header?)
c:\microsoft visual studio\vc98\include\list.h(76) : error C2059: syntax error : '}'
c:\microsoft visual studio\vc98\include\list.h(103) : error C2061: syntax error : identifier 'WINAPI'
c:\microsoft visual studio\vc98\include\list.h(103) : error C2059: syntax error : ';'
c:\microsoft visual studio\vc98\include\list.h(128) : error C2061: syntax error : identifier 'AddToList'
c:\microsoft visual studio\vc98\include\list.h(128) : error C2059: syntax error : ';'
c:\microsoft visual studio\vc98\include\list.h(128) : error C2146: syntax error : missing ')' before identifier 'List'
c:\microsoft visual studio\vc98\include\list.h(128) : error C2061: syntax error : identifier 'List'
c:\microsoft visual studio\vc98\include\list.h(128) : error C2059: syntax error : ','
c:\microsoft visual studio\vc98\include\list.h(128) : error C2059: syntax error : ')'
c:\microsoft visual studio\vc98\include\list.h(203) : error C2061: syntax error : identifier 'DeleteFromList'
c:\microsoft visual studio\vc98\include\list.h(203) : error C2059: syntax error : ';'
c:\microsoft visual studio\vc98\include\list.h(203) : error C2146: syntax error : missing ')' before identifier 'List'
c:\microsoft visual studio\vc98\include\list.h(203) : error C2061: syntax error : identifier 'List'
c:\microsoft visual studio\vc98\include\list.h(203) : error C2059: syntax error : ','
c:\microsoft visual studio\vc98\include\list.h(203) : error C2059: syntax error : ')'
c:\microsoft visual studio\vc98\include\list.h(268) : error C2061: syntax error : identifier 'AddToFrontOfList'
c:\microsoft visual studio\vc98\include\list.h(268) : error C2059: syntax error : ';'
c:\microsoft visual studio\vc98\include\list.h(268) : error C2146: syntax error : missing ')' before identifier 'List'
c:\microsoft visual studio\vc98\include\list.h(268) : error C2061: syntax error : identifier 'List'
c:\microsoft visual studio\vc98\include\list.h(268) : error C2059: syntax error : ','
c:\microsoft visual studio\vc98\include\list.h(268) : error C2059: syntax error : ')'
c:\microsoft visual studio\vc98\include\list.h(281) : error C2061: syntax error : identifier 'AddToEndOfList'
c:\microsoft visual studio\vc98\include\list.h(281) : error C2059: syntax error : ';'
c:\microsoft visual studio\vc98\include\list.h(281) : error C2146: syntax error : missing ')' before identifier 'List'
c:\microsoft visual studio\vc98\include\list.h(281) : error C2061: syntax error : identifier 'List'
c:\microsoft visual studio\vc98\include\list.h(281) : error C2059: syntax error : ','
c:\microsoft visual studio\vc98\include\list.h(281) : error C2059: syntax error : ')'
c:\microsoft visual studio\vc98\include\list.h(294) : error C2061: syntax error : identifier 'DeleteFromFrontOfList'
c:\microsoft visual studio\vc98\include\list.h(294) : error C2059: syntax error : ';'
c:\microsoft visual studio\vc98\include\list.h(294) : error C2146: syntax error : missing ')' before identifier 'List'
c:\microsoft visual studio\vc98\include\list.h(294) : error C2061: syntax error : identifier 'List'
c:\microsoft visual studio\vc98\include\list.h(294) : error C2059: syntax error : ')'
c:\microsoft visual studio\vc98\include\list.h(295) : error C2449: found '{' at file scope (missing function header?)
c:\microsoft visual studio\vc98\include\list.h(297) : error C2059: syntax error : '}'
c:\microsoft visual studio\myprojects\prj2\1.c(51) : fatal error C1071: unexpected end of file found in comment
Error executing cl.exe.

1.obj - 58 error(s), 0 warning(s)
请问这是什么问题啊,求大神
...全文
458 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
ypg231687 2012-10-12
  • 打赏
  • 举报
回复
#includ<list.h> 它的搜索路径是默认系统的.h根目录
#include“list.h”这是搜索你建的文件的根目录 先搜索这个目录 这个目录找不到 下来再搜索 系统根目录

这个都找不到 系统里面也是没有的
ypg231687 2012-10-12
  • 打赏
  • 举报
回复
那是用户自己定义的头文件 头文件主要是数据申明 定义数据对象 还有一些宏 内置函数 函数的申明 在头文件里声明的函数 你还要写出它实现部分 系统的头文件,系统都给你实现好了,就是所谓的运行库 里面包括EXE .DLL 等好多可执行文件,你是看不到里面的算法的,DLL 就是二进制代码运行效率最高,你现在出的事代码一级基础 dll就是二进制一级基础,有两种办法 第一种:就是先建一个.h头文件,在这个头文件里申明你的数据 还有函数申明等等,在建立一个.cpp文件来实现你所定义的函数 用#include“list.h”导入,
第二种:就是给自己建头文件和运行库 对你以后有很大的用处,就是所谓的DLL文件,具体实现这里就不说了
生产dll 用太的时候 只需要两个他生生成的文件,一个是.DLL .ill然后 具体实现 用时网上多很
BYD123 2012-10-12
  • 打赏
  • 举报
回复
C++标准库一般都是: #include <xxx>,老的格式是 #include <xxx.h>。
另外用C++标准库必须用std名字空间,要么在头文件用 using namesapce std; 要么变量/类用std::xxx;
图灵狗 2012-10-11
  • 打赏
  • 举报
回复
应该这样引用:
#include <list>
using namespace std;
diaolingle 2012-10-11
  • 打赏
  • 举报
回复
有的,在 VC98\Include有list.h这个文件[Quote=引用 1 楼 的回复:]

VC下没有list.h头文件吧, 你的头文件自己写的?
[/Quote]
armsword 2012-10-11
  • 打赏
  • 举报
回复
VC下没有list.h头文件吧, 你的头文件自己写的?
【前言】 工作或学习中可能需要实现基于VC读\写Excel文件的功能,本人最近也遇到了该问题。中间虽经波折,但是最终还是找到了解决问题的办法。 在此跟大家分享,希望对跟我同样迷茫过的同学们有所帮助。 1、程序功能 1)打开一个excel文件; 2)显示到CListCtrl上; 3)新建一个Excel文件。 以上均在对话框中实现。 2、平台 VC++2010 3、实现方法 常用的Excel打开方式有两种 1)通过数据库打开; 2)OLE方式打开。 由于方式1)操作繁琐,经常出现莫名的错误,这里选用方式2). 4、准备步骤 首先新建一个Dialog窗体程序,添加list control和两个按钮 1)将ExcelLib文件夹拷贝到程序目录下; 2)将Export2Excel.h,Export2Excel.cpp两个文件添加到项目; 3)包含头文件,#include "ExcelLib/Export2Excel.h" 通过以上步骤在程序中引入了可以读取Excle文件的CExport2Excel类; 5、打开excel文件 通过按钮点击打开 void CExcelTestDlg::OnBnClickedButtonOpenExcel() { //获取文件路径 CFileDialog* lpszOpenFile; CString szGetName; lpszOpenFile = new CFileDialog(TRUE,"","",OFN_FILEMUSTEXIST|OFN_HIDEREADONLY,"Excel File(*.xlsx;*.xls)|*.xls;*.xlsx",NULL); if (lpszOpenFile->DoModal()==IDOK) { szGetName = lpszOpenFile->GetPathName(); SetWindowText(szGetName); delete lpszOpenFile; } else return; //打开文件 //文件中包含多个sheet时,默认打开第一个sheet CExport2Excel Excel_example; Excel_example.OpenExcel(szGetName); //获取sheet个数 int iSheetNum = Excel_example.GetSheetsNumber(); //获取已使用表格行列数 int iRows = Excel_example.GetRowCount(); int iCols = Excel_example.GetColCount(); //获取单元格的内容 CString cs_temp = Excel_example.GetText(1,1); //AfxMessageBox(cs_temp); //List control上显示 //获取工作表列名(第一行) CStringArray m_HeadName; m_HeadName.Add(_T("ID")); for (int i=1;iGetItemCount()>0) { m_list.DeleteColumn(0); } //初始化ClistCtrl,加入列名 InitList(m_list,m_HeadName); //填入内容 //第一行是标题,所以从第2行开始 CString num; int pos; for (int row = 2;row<=iRows; row++) { pos = m_list.GetItemCount(); num.Format(_T("%d"),pos +1); m_list.InsertItem(pos,num); for (int colum=1;columDoModal()==IDOK) { szGetName = lpszOpenFile->GetPathName(); SetWindowText(szGetName); delete lpszOpenFile; } else return; //文件全名称 CString csFileName = szGetName; //需要添加的两个sheet的名称 CString csSheetName = "newSheet"; CString csSheetName2 = "newSheet2"; // 新建一个excel文件,自己写入文字 CExport2Excel Excel_example; //新建excel文件 Excel_example.CreateExcel(csFileName); //添加sheet,新加的sheet在前,也就是序号为1 Excel_example.CreateSheet(csSheetName); Excel_example.CreateSheet(csSheetName2); //操作最开始添加的sheet:(newSheet) Excel_example.SetSheet(2); //添加表头 Excel_example.WriteHeader(1,"第一列"); Excel_example.WriteHeader(2,"第二列"); //添加核心数据 Excel_example.WriteData(1,1,"数据1"); Excel_example.WriteData(1,2,"数据2"); //保存文件 Excel_example.Save(); //关闭文件 Excel_example.Close(); } 7、注意事项 1)一般单个Excel文件包含多个sheet,程序默认打开第一个; 2)指定操作sheet,使用Excel_example.SetSheet(2)函数; 3)打开文件时最左侧的sheet序号为1,新建excel时最新添加的sheet序号为1. 【后记】 本程序主要基于网络CSDN中---“Excel封装库V2.0”---完成,下载地址是:http://download.csdn.net/detail/yeah2000/3576494,在此表示感谢!同时, 1)在其基础上作了小改动,改正了几个小错误,添加了几个小接口; 2)添加了如何使用的例子,原程序是没有的; 3)详细的注释 发现不足之处,还请大家多多指教!

70,022

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧