Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include file not found #24

Open
Trevor89 opened this issue Apr 5, 2021 · 7 comments
Open

Include file not found #24

Trevor89 opened this issue Apr 5, 2021 · 7 comments

Comments

@Trevor89
Copy link

Trevor89 commented Apr 5, 2021

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.

@Viladoman
Copy link
Owner

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.

@Trevor89
Copy link
Author

Trevor89 commented Apr 5, 2021

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

@Viladoman
Copy link
Owner

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.

@Trevor89
Copy link
Author

Trevor89 commented Apr 5, 2021

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)

@BobbyAnguelov
Copy link

BobbyAnguelov commented Aug 9, 2022

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
Copy link

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...

@Viladoman
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants