Closed shanataru closed 2 years ago
When you open your project do you have (Workspace) in the titlebar? Like so:
If not, you need to double click on the ProjectName.code-workspace project file, in your project directory, to open the project as a workspace.
If you are opening it as a workspace I should be able to release an extension version that helps narrow down why you're getting the error. It might take a few releases to help narrow down the problem though.
Something else you can check. Can you create a new test project and check if that errors as well? What OS are you running?
Hi again, I have the workspace titlebar enabled, I am opening the VS Code as you said so the project should start properly. I am working with an archvis project (if it's relevant) - I first create the project, then create a c++ class, which then opens in the IDE. The error persists - Intellisense just does not work and I have the aforementioned errors. Even closing and re-opening via code-workspace does not help. I am working on Windows 10.
I released 3.1.1.
It probably wont fix your bug but will add error messages to point me in the right direction. Let me know if you see any new error messages in the logs.
I'll still have to update the extension again till I can find the reason your project is invalid.
Hi and thank you, here's the new error message with the released version 3.1.1
** Error **: Error in loadCompileCommandsFromWorkspace!
I updated the extension again to get more error messages. Let me know what new ones pop up. Thanks!
Error in v3.1.2:
** Error **: 0: Couldn't create compileCommands from D:\Unreal Projects\RT_ToolStack\.vscode\compileCommands_Default.json with key:MAIN! (not an error with UE 4.25.#)
** Error **: Did not create any compile commands with keyMAIN! (not an error with UE 4.25.#)
My _compileCommandsDefault.json is pretty much empty with only brackets [ ]
Do you have any .cpp or .h files in your Source/ProjectName directory?
Make sure compileCommands_Default.json isn't read only or protected somehow.
Try to Generate Project Files again to see if this fixes this file. How are you Generating Project Files? Can you try other ways? I think there are 3 ways total.
If that doesn't works try right clicking on your project's *.uproject file and choose Switch Engine Version and choose the same engine version and hit ok. Does that work?
Hi,
I have ProjectName.Build.cs, ProjectName.cpp and ProjectName.h in my Source/ProjectName directory. _compileCommandsDefault.json is not specially protected or read-only.
I tried to generate with the .uproject (right click - Generate Visual Studio project files). I also tried through shell running UnrealBuildTool:
.\UnrealBuildTool.exe -projectfiles -project="Path_To_Project/ProjectName.uproject" -game -rocket -progress -engine -VSCode
I tried to refresh Visual Studio Code from the UE editor. I do not know the third way to generate project files.
Switching to the same version did not work either.
Maybe you can test it out at your local machine with the archvis project as I did above? I might just be doing something silly.
Thank you
Ah so the ArchVis project is a Blueprint project by default.
Did ProjectName.cpp and ProjectName.h show up after you created a different C++ class in the Editor with the C++ class creator?
Or did you create the ProjectName.cpp and ProjectName.h yourself? That could be a problem since I believe those files get created automatically when converting a Blueprint project to a C++ project (by creating any C++ class).
Or manually create the files without the C++ class creator in the Editor?
I can't test this currently since this computer can't run UE5. My UE5 computer arrives tomorrow and I'll have to build it. I can test this in 4.27 though. It'll probably be the same.
With 4.27 it worked. I created a trafic light actor from the editor's C++ class creator.
4.27 did create a projectname.h and projectname.cpp automatically when creating this actor.
Everything works with 4.27 and intellisense. If this doesn't apply to UE5 then let me know. I'll have to retest it either tomorrow or Friday in UE5.
Hi, I did not create the ProjectName.h and ProjectName.cpp manually, it got created automatically after I created a new c++ class from the UE editor. It prompted that the project now includes sources and that a build from IDE is needed. Then the IDE is opened with generated .h and .cpp. I restart the IDE and open the .code-workspace. Still same errors.
I have tried it in 4.27 (archvis, same steps) and it works for me, even Intellisense works. It most likely have something to do with UE5.
There should be another compileCommands_ProjectName.json in the .vscode directory.
Only this is in the .vscode directory, _compileCommandsDefault directory is empty:
I do not know if it's relevant but this is the .vscode in the UE5 dir:
Very strange.
I'll check it out after my one part I'm waiting for arrives!
Unfortunately took longer as I thought it would.
It definitely is bugged. Pretty strange one.
I think there is a way to do it though but would require some work.
I'll try to test this to see if it works.
I'm sure it's possible but I haven't had any luck. I'll try something else.
I'm sure it's possible but I haven't had any luck. I'll try something else.
Do you mean creating the project from a blank game C++ project did not work?
I was a little too negative. It actually does work if all you want is all the same plugins that are enabled in the default archvis project.
So that actually works. You can then create your own map.
Trying to migrate the archvis content/map was where I was having difficulty. But you don't need it if you're just going to create your own stuff.
To copy plugins list just open your archvis .uproject file in a text editor. Copy the plugins and paste them in a C++ project's .uproject file. There will be 2 plugins that are duplicates. One of the dupe plugins does have different options between the archvis and c++ projects. You can decide which dupe plugin you want to keep.
Also I was trying to migrate the entire map. If you want to migrate individual content then you might have better luck doing that. There might be some useful Blueprint you might want to migrate over to your C++ project.
Thank you for your hard work. I suppose there is no other way around than to just use the Game C++ project? I will be using the migrating solution for now.
I was able to get the migration fully working which lead me to find out what was causing the problem.
The plugin DatasmithCADImporter is the cause of the bug. Pretty strange!
So to fix:
Note: You can fix an already created project by disabling the plugin as well.
If you need that plugin you can enable it briefly and then disable it after you import.
You should probably make a bug report about it.
Oh noes, not this plugin again...
This is a great find though! Thank you so much for your help!
You can ignore this but it's a meme about message boards about someone telling that they figured something out but not explaining how they did it.
So here's how I migrated in case someone finds this:
I right clicked the content folder and selected the migrate option.
A windows will pop up showing the content to migrate. I had to make sure only the Game folder was selected. This folder had the Content directory assets. You can pick and choose the items in the Game folder or just migrate them all.
Now it'll ask you which project you want to migrate these assets to. Choose a project's content folder.
Once done you'll need to enable or copy over all the same plugins manually. (see above how sometimes this goes wrong)
Now you need to copy over the ini files found in the Config folder. You need to do this manually. You have to be careful. Some ini files can be copied fully, some need to be selectively copied. Here's how I did the ArchVis project ini files.
Copy all DefaultEditor.ini Copy all DefaultEditorPerProjectUserSettings.ini Copy all DeafultLightmass.ini
Inside DefaultEngine.ini:
[/Script/Engine.RendererSettings] Copied all settings(some settings are separated by spaces) and overwrote the settings already there
[/Script/EngineSettings.GameMapsSettings] Copied all settings and overwrote the settings already there
[/Script/UnrealEd.UnrealEdEngine] Created this category and copied all settings
[/Script/Engine.PhysicsSettings] Created this category and copied all settings
[/Script/Engine.CollisionProfile] Created this category and copied all settings
[/Script/WindowsTargetPlatform.WindowsTargetSettings] Copied all settings and overwrote the settings already there (If you're not on Windows, this setting's section name might be different)
[/Script/Engine.Engine] Copied all settings and overwrote the settings already there
Hello, I have installed this extension through VSIX and enabled the fixes as stated in the readme. I have not touched the original _c_cppproperties.json or _compileCommandsDefault.json.
I am moving from Visual Studio to VS Code, so I had to regenerate project files after setting the source code IDE to Visual Studio Code in UE (and after deleting folders: Immediate, Saved, Binaries and *.sln files).
I am using UE 5.0.2 and the extension version is 3.1.0 but no matter how many restarts and re-generating I do, I keep getting these errors:
I can build and run the code, the only problem is that header files are not being recognized (#include errors detected...). Is there a way to fix this?
Thank you in advance!