Friday, February 24, 2023

Unreal - Visual Studio Code includePath error: Invalid escape character in string.

Problem:

Recently, I began working with C++ for Unreal Engine 5.1. As part of the setup process, you configure your development to be done with Visual Studio Code. Details here: https://docs.unrealengine.com/5.1/en-US/setting-up-visual-studio-code-for-unreal-engine/

However, they mention adding the follow code to your c_cpp_properties.json:

"includePath": [ "${workspaceFolder}\\Plugins\\**", "C:\\${workspaceFolder}\\Source\\**", "${workspaceFolder}\\Intermediate\\**" ], 


This will produce an error: Invalid escape character in string. jsonc(261)




Solution:

This pretty close, but is missing a second forward slash "\" required to accurately set these glob patterns:

"includePath": [ "${workspaceFolder}\\Plugins\\**", "C:\\${workspaceFolder}\\Source\\**", "${workspaceFolder}\\Intermediate\\**" ], 

No comments: