C1083: Unable to open file "serialheader.h": no such file or directory

I am writing a wrapper for a library written in C.


The header file for this library is located in
C: \ Projects \ SerialLibrary
The wrapper is located in
C: \ Projects \ SerialLibrary \ Client \ ClrSerialLibrary

no matter what i do, VS2008 can't seem to find

#include "serialheader.h"

      

I always get a file or directory like this error. I tried to put the hard coded path to the directory in ClrSerialLibrary Properties-> Configuration Properties-> C / C ++ -> General-> Additional Include Directories

I have also tried

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

      

I also tried to place a copy of the header file in the same directory as the clr library. Bad luck! Help!

+1


a source to share


2 answers


And have you already checked all the potential problems mentioned in msdn?



  • The file does not exist.
  • The file, subdirectory, or disk is read-only.
  • File or directory access denied.
  • Not enough files. Close some applications and recompile.
  • The INCLUDE environment variable is not set correctly.
  • The #include directive uses double quotes around the path specification, which skips standard directories.
  • You have not specified / clr and your program uses CLR constructs.
  • You tried to compile one file per project without first compiling stdafx.cpp. Before you can compile a single file in a project, you need to compile stdafx.cpp. In the case of the / analysis (Enterprise Code Analysis) compiler option, you will need to use the same / analysis option for stdafx.cpp that you use for the .cpp file.
+2


a source


I cannot tell you the answer from my head, but I am convinced that this is exactly the problem that inevitably gives way to a little determination and logical problem solving. I would do the following:

1) Find something that works, try other possibilities you haven't thought of yet, like

- #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..h file



3) Once you get something to work, you make sure that neither you nor your IDE is irrational and / or crazy. At this point, you'll be ready ...

4) ... gradually turn a working but contrived situation into a practical situation that you can actually use. Do this gradually at each test step so that the new setting still works.

I'm guessing somewhere in step 4) you will have aha! moment, and everything will become clear. Even if it doesn't, you should have something that works that you can use at the same time.

Note that with minor changes in details, the recipe above is good for a huge variety of problems with no programming hassles!

+2


a source







All Articles