简体   繁体   English

C1083:无法打开包含文件'serialheader.h':没有这样的文件或目录

[英]C1083: Cannot open include file 'serialheader.h': No such file or directory

I am writing a wrapper for a library written in C. 我正在为用C编写的库编写包装器。


The header file for this library is located in 该库的头文件位于
C:\\Projects\\SerialLibrary C:\\项目\\ SerialLibrary
The wrapper is located in 包装器位于
C:\\Projects\\SerialLibrary\\Client\\ClrSerialLibrary C:\\项目\\ SerialLibrary \\客户端\\ ClrSerialLibrary

no matter what I do, VS2008, cannot seem to find 无论我做什么,VS2008,似乎无法找到

#include "serialheader.h"

I always am getting the no such file or directory error. 我总是得到没有这样的文件或目录错误。 I have tried putting a hard coded path to the directory in ClrSerialLibrary Property Pages->Configuration Properties->C/C++->General->Additional Include Directories 我已经尝试将一个硬编码路径放到ClrSerialLibrary属性页面 - >配置属性 - > C / C ++ - >常规 - >其他包含目录中的目录

I've also tried 我也试过了

#include "..\..\serialheader.h"

I've also tried placing a copy of the header file in the same directory as the clr library.. No luck! 我也尝试将头文件的副本放在与clr库相同的目录中..没有运气! Help! 救命!

And you have already checked for all the potential issues mentioned at msdn? 你已经检查了msdn中提到的所有潜在问题?

  1. File does not exist. 文件不存在。
  2. File, subdirectory, or disk is read-only. 文件,子目录或磁盘是只读的。
  3. No access permission for file or directory. 没有文件或目录的访问权限。
  4. Not enough file handles. 没有足够的文件句柄。 Close some applications and recompile. 关闭一些应用程序并重新编译。
  5. The INCLUDE environment variable is set incorrectly. INCLUDE环境变量设置不正确。
  6. An #include directive uses double quotation marks around a path specification, which causes the standard directories to be skipped. #include指令在路径规范周围使用双引号,这会导致跳过标准目录。
  7. You did not specify /clr and your program uses CLR constructs. 您没有指定/ clr,您的程序使用CLR结构。
  8. You attempted to compile a single file in the project without first compiling stdafx.cpp. 您试图在没有首先编译stdafx.cpp的情况下编译项目中的单个文件。 Before you can compile a single file in the project, you need to compile stdafx.cpp. 在编译项目中的单个文件之前,需要编译stdafx.cpp。 In the case of the /analyze (Enterprise Code Analysis) compiler option, you will need to use the same /analyze setting for stdafx.cpp that you use for the .cpp file. 对于/ analyze(企业代码分析)编译器选项,您将需要对用于.cpp文件的stdafx.cpp使用相同的/ analyze设置。

I can't tell you the answer off the top of my head but I'm convinced this is exactly the sort of problem that inevitably succumbs to a little determination and logical problem solving. 我不能告诉你最重要的答案,但我确信这正是那种不可避免地屈服于一点决心和逻辑解决问题的问题。 I'd do the following; 我会做以下事情;

1) Find something that works, try other possibilities you haven't thought of yet eg 1)找到有用的东西,尝试其他你尚未想到的可能性,例如

- #include "c:\projects\seriallibrary\serialheader.h"
- #include <serialheader.h>
- Copy serialheader.h to a known good include directory

2) If nothing works, reduce the problem to a minimum - one .cpp file one .h file 2)如果什么都不起作用,将问题减少到最小 - 一个.cpp文件一个.h文件

3) Once you get something to work, you'll be convinced that neither you or your development environment is irrational and/or crazy. 3)一旦你得到了一些工作,你就会确信你或你的发展环境都不合理和/或疯狂。 At that stage you'll be ready to... 在那个阶段你会准备......

4) ...progressively transform the working but contrived situation into a practical situation you can actually use. 4)......逐步将工作但人为的情况转化为实际可以使用的实际情况。 Do this progressively at each stage testing that the new setup still works. 在测试新设置仍然有效的每个阶段逐步执行此操作。

I am guessing that somewhere in step 4) you'll have an aha! 我猜你在步骤4)的某个地方你会有一个啊哈! moment and everything will become clear. 时刻,一切都会变得清晰。 Even if it doesn't you should have something that works that you can use in the meantime. 即使它没有,你应该有一些可以在此期间使用的东西。

Note that with a few detail changes the recipe above is good for a huge variety of non-profound programming problems! 请注意,通过一些细节更改,上面的配方适用于各种非深刻的编程问题!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM