boocs / ue4-intellisense-fixes

Automatically fixes VSCode/Unreal Engine Intellisense Config bugs on startup
MIT License
162 stars 9 forks source link

M1 Mac issues #23

Closed boocs closed 2 years ago

boocs commented 2 years ago

Also - In the logs of the C++ extension I see this:

[8/31/2022, 9:17:18 AM] For C source files, IntelliSenseMode was changed from "macos-clang-x64" to "macos-clang-arm64" based on compiler args and querying compilerPath: "/opt/homebrew/opt/llvm@12/bin/clang"
[8/31/2022, 9:17:18 AM] IntelliSenseMode was changed because it didn't match the detected compiler.  Consider setting "compilerPath" instead.  Set "compilerPath" to "" to disable detection of system includes and defines.
[8/31/2022, 9:17:18 AM] For C++ source files, IntelliSenseMode was changed from "macos-clang-x64" to "macos-clang-arm64" based on compiler args and querying compilerPath: "/opt/homebrew/opt/llvm@12/bin/clang"
[8/31/2022, 9:17:18 AM] IntelliSenseMode was changed because it didn't match the detected compiler.  Consider setting "compilerPath" instead.  Set "compilerPath" to "" to disable detection of system includes and defines.
[8/31/2022, 9:17:19 AM] For C++ source files, IntelliSenseMode was changed from "macos-clang-x64" to "macos-clang-arm64" based on compiler args and querying compilerPath: "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"

Originally posted by @leonfs in https://github.com/boocs/ue4-intellisense-fixes/issues/22#issuecomment-1232615717

boocs commented 2 years ago

@leonfs

Seems like this means the compilerPath is mismatched with the compiler in the compile commands file.

In my extension you can set the path setting to the full xcode/clang++ path. You can also see what path the compile commands is using by checking my extension's log if you want to match exactly.

Below is the compile commands first entry command. (WARNING) If getting errors and the compiler path is unexpected reset your UE project.
command: "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.32.31326\bin\HostX64\x64\cl.exe" @"D:\EJ\Documents\Unreal Projects\CPPTest\.vscode\compileCommands_CPPTest\CPPTest.211.rsp"

For example, my project's extension log above it says it's using "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.32.31326\bin\HostX64\x64\cl.exe"

I think I remember reading somewhere that if you just use user/bin/clang++ on Mac the VSCode will try to find whichever one it can in certain known installation spots. That's why it could be mismatched.

In my latest extension version I also have a IntelliSensenseMode setting. You can change it to whichever type of project you're targeting. If you're creating a Native M1 app or some other Arm64 project then you should change the Intellisense Mode. Usually Unreal doesn't use the first part of the Intellisense Mode so try clang-arm64 at first. Of course if you're not targeting a Native project try clang-x64.

Not using the first part of Intellisense Modes could be wrong for M1 macs though so if it doesn't work try macos-clang-arm64 or whatever works.

boocs commented 2 years ago

@leonfs I've released my guide on how to check for VSCode config bugs. This is just a partial Include Errors release. Note: This will get reorganized and changed.

https://github.com/boocs/Unreal-VSCode-diy-config-check-github

boocs commented 2 years ago

Released new updates should fix this. On Mac compiler path might have to be set to /usr/bin/clang++ to work correctly. Whatever compiler this translates to you'll have to change if it's the wrong compiler.

I tested new update on a M1 Mac and it works. I did have to set extension's path setting to /usr/bin/clang++ though.