StructLayout icon indicating copy to clipboard operation
StructLayout copied to clipboard

Include file not found

Open Trevor89 opened this issue 3 years ago • 7 comments

I keep getting "File not found" no matter if I explicitly include the file in settings or not. the message reads

In the file included from x:\xxx\xxxtypes.h:3:
x:\xxx\xxxconstants.h:3:10 fatal error: 'ultra64.h' file not found
#include <ultra64.h>
     ^~~~~~~~
1 error generated.
error while processing x:\xxx\xxxtypes.h.

I have explicitly included ultra64.h in the settings dialog but it still complains.

Trevor89 avatar Apr 05 '21 16:04 Trevor89

Hi! Force including a single header will still make the clang compiler fail when searching for that include, as it is just an extra include added on top of everything.

Could you try adding the ultra64.h path to the extra include directories in the extension settings?

If this still fails. You can try adding to the Extra Compiler Command Line Arguments in the extension settings the include directory where ultra64.h is located with -isystem. -I vs -isystem

Please let me know if this fixes the issue.

Viladoman avatar Apr 05 '21 19:04 Viladoman

Hmm, maybe this wont work then... I thought the addon could parse the text and show struct sizes, I didnt know it was tied to clang. (which wont work I think as its MIPS code) however, I already have these as settings and it still didnt work

  "AdditionalPreprocessorDefinitions": "",
  "AdditionalIncludeDirs": "${ProjectDir};${ProjectDir}\\include;${ProjectDir}\\include\\PR;",
  "AdditionalForceIncludes": "${ProjectDir}\\include\\ultra64.h;",
  "AdditionalCommandLine": "",

here is an example struct

typedef struct PathData
{
  s32 *pads; /*0x00*/
  u8 id;     /*0x04*/
  u8 flags;  /*0x05*/
  u16 len;   /*0x06*/
} PathData;

I was expecting it to show it as 2 words long (32 + 8 + 8 + 16) I thought it would be useful for showing me padding (say I had an extra u8 in there it would pad to 3 words) for now We've been using comments to keep track of starts (/0x00/)

Also, the ultra64.h contains the defs for s32 (int) u8 (char) etc

Trevor89 avatar Apr 05 '21 19:04 Trevor89

Yes. The extension is using Clang to parse the C++ and then extract from its AST the actual offsets and sizes from the active configuration. It only uses the compiler's frontend so it should be fine if the target is MIPS (not familiar with it, so I might be wrong and maybe Clang has some problems dealing with it).

As you said, the whole point of the extension is to get the information you mentioned.

For some odd reason it is failing to find that include in ${ProjectDir}\\include\\. For the sake of testing and figuring this out:

  • Could you try to change the include to #include "ultra64.h"?
  • Could you try to add in the AdditionalCommandLine: -isystem"${ProjectDir}\include\"?

Also if possible, check in the StructLayout output pane inside VS if the command line for compilation is complete or if anything is missing in there.

Viladoman avatar Apr 05 '21 21:04 Viladoman

same error with both additional command line and include using quotes... image image Also, when in dark mode, the extension looks like this (all grey)

Trevor89 avatar Apr 05 '21 22:04 Trevor89

I'm having the same issue all of a sudden. The extension was working great but now it's stopped with the same cannot find file error.

[13:41:23] CLANG ARGUMENTS:  -x c++ -m64 -std=c++17 -w -ID:\Esoterica\External\Freetype\include\ -ID:\Esoterica\External\GameNetworkingSockets\include\GameNetworkingSockets\ -ID:\Esoterica\Code -ID:\Esoterica\Code\System\ThirdParty\ -ID:\Esoterica\External\Optick\include -ID:\Esoterica\External\Navpower\include\ -ID:\Esoterica\External\PhysX\pxshared\Include\ -ID:\Esoterica\External\PhysX\physx\Include\ -I"C:\Program Files\Superluminal\Performance\API\Include\" -ID:\Esoterica\Code\System\ThirdParty\imgui\ -ID:\Esoterica\Code\System\ThirdParty\EA\EASTL\Include\ -ID:\Esoterica\Code\System\ThirdParty\EA\EABase\Include\Common\ -working-directory=D:\Esoterica\Code\System
In file included from D:\Esoterica\Code\System\Settings\Setting.h:5:
D:\Esoterica\Code\System/Types/Arrays.h:4:10: fatal error: 'EASTL/vector.h' file not found
#include "EASTL/vector.h"
         ^~~~~~~~~~~~~~~~
1 error generated.

The strange thing is the include path has been correctly detected and supplied:

-ID:\Esoterica\Code\System\ThirdParty\EA\EASTL\Include\

Manually adding the path doesn't work. Any ideas on what might be going on? I also don't understand why it just stopped working randomly.

BobbyAnguelov avatar Aug 09 '22 17:08 BobbyAnguelov

Okay, figured out why it stopped working, no idea of the actual cause:

Having this include path in the args, breaks it:

-I"C:\Program Files\Superluminal\Performance\API\Include\"

I just noticed that it also has quotation marks around it where the others dont. These are auto infered so I'm not sure what's going on there...

BobbyAnguelov avatar Aug 09 '22 18:08 BobbyAnguelov

That's strange. The quotes are added automatically for paths that contain spaces so that Clang does not think it needs to include C:\Program. When I was running my local tests I always made sure to have stuff in folders with spaces to validate this is working as it should.

Viladoman avatar Aug 09 '22 18:08 Viladoman