VSCode error when launching: The following argument was not expected: /c

When trying to launch my C++ project from VSCode I get an error popup stating:

The following argument was not expected: /c
Run with --help for more information

Another error pops up in the bottom right with:

Unable to start program '....<path to UnrealEditor.exe>'. Unable to start the Microsoft Visual Studio Debug Console.

The log file just shows this:

Generated code is up to date.
Target is up to date
Total execution time: 0.40 seconds
WriteFileIfChanged() wrote 0 changed files of 0 requested writes.
Timeline:

[ 0.000]
[ 0.000](+0.399) <unknown>
[ 0.399]

I’ve found only one possibly promising thread on the internet: https://www.reddit.com/r/VisualStudio/comments/vacmua/vs2022_unable_to_debug_console_programs/

Seems it might be related to environment variables being too long for the MS Debugger?

This happens on a fresh new empty C++ project as well.
Any ideas?

Try to disable your firewall & antivirus too.

Did you install VScode and unreal in C and your unreal project in it default folder c document ?

Yes it could be related to an environment variable.

(personal pref) i suggest using visual studio, my friend had lot of issues with vscode and seem to catch less user error compared to visual studio such as using reserve word name.

Disabling antivirus & firewall, didn’t help unfortunately.

Reverting to a previous version of VSCode resolved the issue.

1 Like

There’s an issue at VSCode’s github describing a similar problem to ours (issue here). It seems that the problem is at the launch.json file. The “console”: “externalTerminal” command is not valid anymore. Changing it to “console”: “internalConsole” works, even though it doesn’t open an external window like the old command.

11 Likes

This is the solution. For those coming from Google, it might be also in the file: .code-workspace.

4 Likes

I can confirm - this worked for me.

It wokrs for me!
I’m using UE4.26, and I’ve changed the launch.json as below:

From

"externalConsole": true,

To:

"console": "integratedTerminal",
2 Likes

I created a temporary extension to fix this. It also has a Revert command. This extension shouldn’t be needed once VSCode fixes the bug.

https://github.com/boocs/unreal-console-fix/

1 Like