包含文件存在但再次显示致命错误C1083:无法打开包含文件 [英] Include File is present but again showing fatal error C1083: Cannot open include file
问题描述
这次Iam在C ++中苦苦挣扎,因为我对此非常陌生,我也有一些启动困难。在这个项目中我使用了很多Header文件和库。同时构建应用程序它显示:致命错误C1083:无法打开包含文件,但文件已经包含在内。在使用此错误进行搜索时,我发现如果给出的路径不正确,那么此错误也会出现。所以我也检查过。所有好的但又一次显示致命错误C1083:无法打开包含文件。
请提供一些帮助。
以下是我的代码:
#include StdAfx.h
#include
#include TciCons.h
#include tftai.h
#define TFTime __time32_t
#include < span class =code-string> tfdescr.h
#include exinfo.h
#include tai.h
#include
#include
#inclu de
#include
#include .. \include\drvstandard.h
#include .. \include\drvtool.h //原型驱动程序开发
#include .. \include\UniTCPIPImports.h //原型并定义为TCP / IP通信库
< span class =code-keyword> #include .. \\\ quot; \ theicicode.h
#include TsTCPAlarmItem.h
#define DRIVER_NAME _T(TSTCP)
static TCHAR szDrvVersion [] = _T( 1.1.01跨度>);
unsigned long localtime_julian(长蒂姆);
int ServiceRequest(COM_RESP_REC& com_resp_rec);
#define BUFSIZE1 512 * 1024
CTciCons :: CTciCons( void )
{
nProtocol = PROTOCOL_DB2;
pArchive = NULL;
pSetup = NULL;
pSetupExtra = NULL;
memset(& CpcRespRec, 0 , sizeof (CpcRespRec));
memset(& Db2Params, 0 , sizeof (Db2Params));
memset(& Db2, 0 , sizeof (Db2));
memset(& Db1, 0 , sizeof (Db1));
dnl_buf = new unsigned char [BUFSIZE1];
strncpy(CpcRespRec.com_req.idnum, EM002, 10 跨度>);
memcpy(CpcRespRec.com_req.scode, 0000, 4 );
strncpy(CpcRespRec.com_req.phone_nbr, T166.131.58.7 / 12345, 25 );
CpcRespRec.com_req.comport = 11 ;
// CpcRespRec.com_req.baud = 9600;
CpcRespRec.com_req.linktime = 0 ;
CpcRespRec.com_req.retries = 3 ;
strcpy(CpcRespRec.com_req.work_station_id, EM002);
CpcRespRec.com_req.rem_dev_type = 0 ; // FCU
CpcRespRec.com_req.time_out = 10 跨度>;
CpcRespRec.com_req.com_type = 10 ; // tcp / ip
Db2.bCompressed = 0 跨度>;
Db2.MaxDataBlockSize = 1024 ;
Db2.MaxPacketSize = 8 * 1024 ;
Db2.RemoteRespTimeoutSecs = 10 ;
Db2.retries = 3 ;
Db2.RemoteACKTimeoutSecs = 10 ;
Db2.CharacterTimeoutSecs = 2 ;
/ * Db1.retries = 3;
Db1Params.nCollectDays = 0;
Db1Params.nDataResolution = 0;
Db1Params.nReqType = 0; * /
memset(& GlobalpbutRespRec, 0 ,的sizeof 跨度>(GlobalpbutRespRec));
memset(& GlobalkdtRespRec, 0 , sizeof (GlobalkdtRespRec));
memset(& GlobalValve, 0 , sizeof (GlobalValve));
}
CTciCons :: ~CTciCons( void )
{
delete dnl_buf;
if (pArchive)
ReleaseArchive(pArchive);
if (pSetup)
delete pSetup;
if (pSetupExtra)
delete [] pSetupExtra;
}
/// ////////// /驱动程序配置标准函数/////////////////
//
// 未声明的函数被默认函数替换
int CTciCons :: ProcessCommand( int cmd)
{
char bfr [ 80 ];
ULONG现在;
int opt = cmd;
if (opt< 0)
{
if (nProtocol == PROTOCOL_DB1)
opt = GetDB1Option();
else
opt = GetDB2Option();
}
如果(opt == 0 || opt == 100 ) return 0 ;
if (opt == 1 || opt == 101 )
{
if (nProtocol == PROTOCOL_DB1)
{
nProtocol = PROTOCOL_DB2;
CpcRespRec.com_req.linktime = 0 ;
CpcRespRec.com_req.com_type = 10 ;
}
else
{
nProtocol = PROTOCOL_DB1;
CpcRespRec.com_req.linktime = 1 ;
CpcRespRec.com_req.com_type = 0 ;
}
返回 - 1 ;
}
CpcRespRec.com_req.dnl_buf =( char *)dnl_buf;
switch (opt)
{
case 2 :
BuildRegisterRequest(& CpcRespRec.com_req,& Db2, 9 , 0 , 0 , 1 );
ServiceRequest(CpcRespRec);
ShowRegisters();
break ;
case 3 :
float tmp [ 3 ];
tmp [ 0 ] =( float ) 1003 跨度>;
tmp [ 1 ] =( float ) 0 。 7 ;
tmp [ 2 ] =( float ) 0 跨度>;
BuildRegisterDownload(& CpcRespRec.com_req,& Db2, 9 , 0 , 1 , 1 ,( char *)tmp, 4 );
AddRegisterDownload(& CpcRespRec.com_req, 9 , 0 , 4 , 1 ,( char *)(tmp + 1), 4 );
ServiceRequest(CpcRespRec);
ShowStatus();
break ;
}
delete CpcRespRec.rsp_buf;
memset(bfr, 0 , sizeof (bfr));
得到(bfr);
if (strlen(bfr)== 0 )返回 - 1 ;
return atoi(bfr);
}
int CTciCons :: GetDB1Option()
{
}
int CTciCons :: GetDB2Option()
{
int rtn = 0 跨度>;
char buffer [ 25 ];
printf( _____________________________ \ n);
// printf(DB2协议 - 选择一个选项!\ n);
printf( 准备投票!\ n);
printf( 0)退出\ n);
// printf(1)切换到DB1 \ n);
printf( 3)Read Register\\\
);
printf( 4)Write Register\\\
);
memset(缓冲区, 0 , sizeof (缓冲区));
得到(缓冲区);
if (strlen(buffer)== 0 )返回 0 ;
return atoi(buffer);
}
显示丢失的文件是exinfo.h
你有确保该文件位于编译器搜索路径中。例如,使用Visual Studio 2005
,单击工具 - >选项
菜单项,然后选择项目和解决方案 - > VC ++目录
,在下面的列表中选择包含文件
显示目录:
label并最后添加你的包含文件夹。
解决方案1是正确的(首先看一下)。但是,如果这不能解决您的问题,那么您的标题中可能包含无限循环。如果你包括header1.h,其中包括header2.h,它再次包含header1.h,编译器会感到沮丧。您可以通过以下方式获得赔偿:
- 确保您没有手动包含循环
- #pragma一次
- 标题后卫块。
Hi,
This time Iam Struggling with C++,as Iam very new to this I have some start up difficulties also.In this project Iam using so many Header files and libraries.While building the application it is showing: fatal error C1083: Cannot open include file,but the file is already included.While searching with this error I came to know that if the path given is incorrect then also this error will come.So I checked that also.Everything Ok but again it is showing fatal error C1083: Cannot open include file.
Please suggest some help.
Below is my code:
#include "StdAfx.h"
#include
#include "TciCons.h"
#include "tftai.h"
#define TFTime __time32_t
#include "tfdescr.h"
#include "exinfo.h"
#include "tai.h"
#include
#include
#include
#include
#include "..\include\drvstandard.h"
#include "..\include\drvtool.h" // prototypes driver development
#include "..\include\UniTCPIPImports.h" // prototypes and defines to TCP/IP communication library
#include "..\include\unicode.h"
#include "TsTCPAlarmItem.h"
#define DRIVER_NAME _T("TSTCP")
static TCHAR szDrvVersion[] = _T("1.1.01");
unsigned long localtime_julian(long tim);
int ServiceRequest( COM_RESP_REC& com_resp_rec );
#define BUFSIZE1 512*1024
CTciCons::CTciCons(void)
{
nProtocol = PROTOCOL_DB2;
pArchive = NULL;
pSetup = NULL;
pSetupExtra = NULL;
memset( &CpcRespRec, 0, sizeof(CpcRespRec));
memset( &Db2Params, 0, sizeof(Db2Params));
memset( &Db2, 0, sizeof(Db2));
memset( &Db1, 0, sizeof(Db1));
dnl_buf = new unsigned char[BUFSIZE1];
strncpy( CpcRespRec.com_req.idnum, "EM002", 10);
memcpy( CpcRespRec.com_req.scode,"0000",4 );
strncpy(CpcRespRec.com_req.phone_nbr, "T166.131.58.7/12345", 25);
CpcRespRec.com_req.comport = 11;
//CpcRespRec.com_req.baud = 9600;
CpcRespRec.com_req.linktime = 0;
CpcRespRec.com_req.retries = 3;
strcpy( CpcRespRec.com_req.work_station_id,"EM002");
CpcRespRec.com_req.rem_dev_type = 0; // FCU
CpcRespRec.com_req.time_out = 10;
CpcRespRec.com_req.com_type = 10; // tcp/ip
Db2.bCompressed = 0;
Db2.MaxDataBlockSize = 1024;
Db2.MaxPacketSize = 8 * 1024;
Db2.RemoteRespTimeoutSecs = 10;
Db2.retries = 3;
Db2.RemoteACKTimeoutSecs = 10;
Db2.CharacterTimeoutSecs = 2;
/*Db1.retries = 3;
Db1Params.nCollectDays = 0;
Db1Params.nDataResolution = 0;
Db1Params.nReqType = 0;*/
memset(&GlobalpbutRespRec, 0, sizeof(GlobalpbutRespRec));
memset(&GlobalkdtRespRec, 0, sizeof(GlobalkdtRespRec));
memset(&GlobalValve, 0, sizeof(GlobalValve));
}
CTciCons::~CTciCons(void)
{
delete dnl_buf;
if(pArchive)
ReleaseArchive(pArchive);
if(pSetup)
delete pSetup;
if(pSetupExtra)
delete [] pSetupExtra;
}
////////////// Driver Configuration standard functions /////////////////
//
// The functions not declared are replace by default functions
int CTciCons::ProcessCommand(int cmd)
{
char bfr[80];
ULONG now;
int opt=cmd;
if(opt<0)
{
if(nProtocol==PROTOCOL_DB1)
opt=GetDB1Option();
else
opt=GetDB2Option();
}
if(opt==0||opt==100) return 0;
if(opt==1||opt==101)
{
if(nProtocol==PROTOCOL_DB1)
{
nProtocol=PROTOCOL_DB2;
CpcRespRec.com_req.linktime=0;
CpcRespRec.com_req.com_type=10;
}
else
{
nProtocol=PROTOCOL_DB1;
CpcRespRec.com_req.linktime=1;
CpcRespRec.com_req.com_type=0;
}
return -1;
}
CpcRespRec.com_req.dnl_buf=(char*)dnl_buf;
switch(opt)
{
case 2:
BuildRegisterRequest(&CpcRespRec.com_req,&Db2,9,0,0,1);
ServiceRequest(CpcRespRec);
ShowRegisters();
break;
case 3:
float tmp[3];
tmp[0]=(float)1003;
tmp[1]=(float)0.7;
tmp[2]=(float)0;
BuildRegisterDownload(&CpcRespRec.com_req,&Db2,9,0,1,1,(char *)tmp,4);
AddRegisterDownload(&CpcRespRec.com_req,9,0,4,1,(char *)(tmp+1),4);
ServiceRequest(CpcRespRec);
ShowStatus();
break;
}
delete CpcRespRec.rsp_buf;
memset(bfr,0,sizeof(bfr));
gets(bfr);
if(strlen(bfr)==0) return -1;
return atoi(bfr);
}
int CTciCons::GetDB1Option()
{
}
int CTciCons::GetDB2Option()
{
int rtn = 0;
char buffer[25];
printf( "_____________________________ \n");
// printf( "DB2 Protocol - Choose an Option!\n");
printf( "Ready To Poll!\n");
printf( "0) To quit\n");
//printf( "1) Switch to DB1\n");
printf( "3) Read Register\n");
printf( "4) Write Register\n");
memset(buffer, 0, sizeof(buffer));
gets(buffer);
if(strlen(buffer) == 0) return 0;
return atoi(buffer);
}
And the showing missing file is "exinfo.h"
You have to make sure the file is in the compiler search path. For instance withVisual Studio 2005
, click onTools->Options
menu item, then selectProjects And Solutions->VC++ Directories
, chooseInclude Files
in the list just belowShow Directories For:
label and finally add your include file folder.
Solution 1 is correct (see that one first). If that doesn''t fix your problem however, you might have a infinite loop in your header includes. If you include header1.h, which includes header2.h, which includes header1.h again, the compiler gets upset. You can get indemnity from this with:
- ensuring you don''t have include loops manually
- #pragma once
- header guard blocks.
这篇关于包含文件存在但再次显示致命错误C1083:无法打开包含文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!