IAR Embedded Workbench cannot find files, Pe1696, even though it is searching for them

StackOverflow https://stackoverflow.com/questions/17535123

  •  02-06-2022
  •  | 
  •  

Domanda

I am using IAR Embedded workbench 5.51 for MSP430. I am using C99.

I am trying include code from a third party library. I have copied the directory structure of this third party library exactly within a sub-directory in my main project directory. However, when I try to compile I get a bunch of

Fatal Error[Pe1696]: cannot open source file "ThirdPartyLib/Subdir/file.h"

However in the log IAR shows:

searched: "C:\ ... bla bla bla ... \Source\ThirdPartyLib\Subdir\"

The include statements in each of the source files in this library are all like:

#include "ThirdPartyLib/Subdir/someheader.h"

I have attempted to add the path to the C preprocessor by going to:

Project -> Options -> C/C++ Compiler -> Preprocessor

and adding the lines:

$PROJ_DIR$\ThirdPartyLib\
$PROJ_DIR$\ThirdPartyLib\Subdir\
$PROJ_DIR$\ThirdPartyLib\Utils\

I do not have "Multi-file Compilation" checked.

All of the source files in question have been added to the project. I have created groups to mimic the directory structure of the library.

The problem goes away if I change the paths from absolute paths to relative paths such as

#include "somelocalheader.h"
#include "../Utils/someotherheader.h"

But I am dealing with a large number of files and want to modify them as little as possible.

I have never had an issue with this before - does anyone have any idea why this would happen. Is there a simple fix for this so I do not have to scrub every include statement in every c file?

This is essentially what my directory tree looks like:

  • Source
    • Debug
      • Exe
        • Output.d43
      • List
        • blabla.map
      • Obj
        • ...
    • Release
      • ...
    • settings
      • ...
    • ThirdPartyLib
      • Subdir
        • ... Third Party Code Files Live Here ...
      • Utils
        • ... More Third Party Code Files Live Here ...
    • ... My Code Lives Here, Along with the EWP, EWW, etc ...

EDIT #2: I moved the directory of ThirdPartyLib up a level, because I run doxygen recursively on /Source/ and I realized that it takes doxygen FOREVER, and plus the library has its own API.

Anyway, here is what the structure looks like now:

  • Working Copy
    • Source
      • Debug
        • Exe
          • Output.d43
        • List
          • blabla.map
        • Obj
          • ...
      • Release
        • ...
      • settings
        • ...
      • ... My Code Lives Here, Along with the EWP, EWW, etc ...
    • ThirdPartyLib
      • Subdir
        • ... Third Party Code Files Live Here ...
      • Utils
        • ... More Third Party Code Files Live Here ...

I have added a group back to my project for ThirdPartyLib with two subgroups SubDir and Utils, and added all of the files from the Subdir and Utils directories to the corresponding subgroups.

Now I have tried to compile this again, and again i am faced with the Pe1696 errors. IAR says:

searched: "C:\...\Working Copy\ThirdPartyLib\SubDir"

Yet it is still not finding the files.

I referred to this post: http://e2e.ti.com/support/low_power_rf/f/155/t/110195.aspx I am not sure it is completely relevant, because the directories I am including don't seem to have 'fallen out'. IAR is clearly searching for the files.

But I tried anyway to add the following lines to the preprocessor

$PROJ_DIR$\..\ThirdPartyLib\SubDir
$PROJ_DIR$\..\ThirdPartyLib\utils

This does not seem to help. I get these additional lines in the message log:

searched: "C:\...\Working Copy\Source\..\ThirdPartyLib\SubDir\"
searched: "C:\...\Working Copy\Source\..\ThirdPartyLib\Utils\"

Edit #3 I tried moving the EWW/EWP up a level to "Working Copy" and then readded all of the groups and all of the files... no dice. I am lost here. The part that is most frustrating is that the same library is implemented in another project that was done by some former developers and I am trying to include it the same way. I know this is going to be something trivial, I just don't know what.

È stato utile?

Soluzione

If all of the #include references inside the library are of the form #include "ThirdPartyLib/Subdir/file.h", then the root directory where ThirdPartyLib is located should be in the preprocessor include path.

If your directory structure is:

C:\My Project\Source
             \ThirdPartyLib

then C:\My Project would be expected to be in the preprocessor include path.

When the compiler searches for include files it will join in turn, each of the include search paths with the path listed in the #include directive until a matching file is found.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top