"Unreal Engine C++ Dev"-#include path not defined, can't find <iostream -Help?

“Unreal Engine C++ Dev” - #include path not defined, can’t include - Any help would be great! Here;s the exact error:
"#include errors detected. Please update your includePath. IntelliSense features for this translation unit (D:\Documents\Unreal-Learning\hello.cpp) will be provided by the Tag Parser.

cannot open source file “iostream”

Hi. I’m only on the “hello.cpp” (very first program) of the Unreal/C++ course, using VS Code as editor. Everything worked up to this point, but in simply trying to include a file, obviously there’s no correct default IncludePath set. I did try to add the path where I found “iostream” (D:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\crt\src\stl), but either I did it wrong or put it in the wrong place.

Any help would be most appreciated! – Using VS Code 1.1, Microsoft ® C/C++ Optimizing Compiler Version 19.20.27508.1 for x86, installed the C++ Intellisense extension from Microsoft in VS Code.

Thanks!
Matt

Where did you put it? The c_cpp_properties.json file? Could you show it?

Hi, I didn’t put the file anywhere. When I closed VS Code the first time and re-opened it, one of the notifications said that I hadn’t defined my includepath so I clicked that and it opened the file, and I edited it there.

After that, I couldn’t even find the file again, so I did a global search on it, and I found it on my D: Drive, in the root directory, in a folder called “.vscode”. It is the ONLY file in that directory, which is weird.

Here is what is in the file and it is definitely the one I edited, as it contains that D path to my Visual Studio directory.
FILENAME: c_cpp_properties.json in D:.vscode

"{
“configurations”: [
{
“name”: “Win32”,
“includePath”: [
“${workspaceFolder}/**”,
“D:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\crt\src\stl”
],
“defines”: [
“_DEBUG”,
“UNICODE”,
“_UNICODE”
],
“intelliSenseMode”: “msvc-x64”
}
],
“version”: 4
}

"

Heya Matt,

I was watching this while hoping for an answer to the same problem! This is what I found and have done which seems to have fixed mine.

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "compilerPath": "F:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.14.26428/bin/Hostx64/x64/cl.exe",
            "intelliSenseMode": "msvc-x64",
            "cppStandard": "c++17"
        }
    ],
    "version": 4
}

This is my c_cpp_properties.json file. To find it and anything else surronding this problem check this link https://code.visualstudio.com/docs/cpp/config-msvc

Good luck buddy!

Oh!! Thanks! I’m so glad it worked for you!!!

The link you gave me for the tutorial is the best. I started walking through it, and there’s already so much of it I haven’t done.

I wish the Unreal/C++ Udemy course had at least discussed this, and maybe sent it to a secondary link. There was nothing in the Udemy course about setup/preconfiguration.

I won’t be able to actually test this until Wednesday, but I so appreciate your response.

One thing though … I still don’t get where the c_cpp_properties.json file should be. That’s one of the very frustrating things I find about all the help topics … they just say stuff like “Open this and fix it” and never state even a general idea of where “it” is.

So, mine is in that single directory D:.vscode, and reading the link you sent me, that seems totally wrong.

Any help on the idea of where your lovely and beautiful file should actuallty go would be most helpful!

Thank you, and thank you in advance to anyone who answers. I’m just trying to power forward and make a game here (or any other program), like anyone else.

Matt

Sorry that was poor wording on my part. I meant where did you put it within the c_cpp_properties.json.

Your c_cpp_properties.json will exist inside your workspace’s .vscode directory. i.e. if I’m working in D:\Projects\Repos\Test then my directory would look like:

Thanks everyone for your help. I am getting somewhere … but I have a new block.
I followed the steps listed https://code.visualstudio.com/docs/cpp/config-msvc

There are certainly many things in these steps that aren’t ever even touched on in the Unreal Class, but that aside, I just want to get SOMETHING working. So, in following these steps, I did resolve the IncludePath problem by setting the Compiler Path stuff up as Marc_Hemming suggested, and I added the Launch.json and Task.Jason as indicated in the tutorial.

Now, when trying to compile (using the Build method, Shift+Ctrl+B, it says that “‘D:\Program’ is not recognized as an internal or external command, operable program”. So it seems that somewhere it is interpreting the space after D:\Program Files (x86)… as the end of the command path, or at least, that’s all I can think.

Here are all the files I added:
c_cpp_properties.json:
{
“configurations”: [
{
“name”: “Win32”,

        "defines": [
            "_DEBUG",
            "UNICODE",
            "_UNICODE"
        ],
        "compilerPath": "D:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.20.27508/bin/Hostx64/x64/cl.exe",
        "windowsSdkVersion": "10.0.17763.0",
        "intelliSenseMode": "msvc-x64",
        "cStandard": "c11",
        "cppStandard": "c++17"
    
        
    }
],
"version": 4

}

tasks.json:
{
“version”: “2.0.0”,
“tasks”: [
{
“label”: “msvc build”,
“type”: “shell”,
“command”: “cl.exe”,
“args”: [
“/EHsc”,
“/Zi”,
“/Fe:”,
“helloworld.exe”,
“helloworld.cpp”
],
“group”: {
“kind”: “build”,
“isDefault”: true
},
“presentation”: {
“reveal”:“always”
},
“problemMatcher”: “$msCompile”
}
]
}

launch.json:
{
“version”: “0.2.0”,
“configurations”: [
{
“name”: “(msvc) Launch”,
“type”: “cppvsdbg”,
“request”: “launch”,
“program”: “{workspaceFolder}/helloworld.exe", "args": [], "stopAtEntry": true, "cwd": "{workspaceFolder}”,
“environment”: ,
“externalConsole”: false
}
]
}

helloworld.cpp:
#include
#include
#include

using namespace std;

int main()
{

vector<string> msg {"Hello", "C++", "World", "from", "VS Code!"};

for (const string& word : msg)
{
    cout << word << " ";
}
cout << endl;

}


Any help would be most appreciated, and thanks for all the help so far!

Matt

If you want to use the build task you need to launch VS Code through the developer command prompt.
Just type “code” in there to do so.

This topic was automatically closed after 2 days. New replies are no longer allowed.

Privacy & Terms