#include <iostream> (Widows--not resolved with lesson 17)

My Code:

#include <iostream>

int main()
{
    std::cout << "Hello, World!";
    return 0;
}

I have the red underline on the #include line. The error is “cannot open source file “crtdbg.h” (dependency of “iostream”)”

I have carefully followed the steps in lesson 17 to ensure that the compiler path is in there–I compared what was there by default to what came up after typing in “where cl” and it checks out.

Do I need to install something else to get this to work? I’ve been directed to this page by the error message: https://docs.microsoft.com/en-us/cpp/build/vcpkg?view=vs-2019

Thanks for your help!

Are you still able to compile?

Thanks for your response. No, it does not compile. It says:

“C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\yvals.h(12): fatal error C1083: Cannot open include file: ‘crtdbg.h’: No such file or directory”

So as before, it is all about “crtdbg.h”

Are you sure you installed Visual Studio with these options?

How can I check that? Maybe I missed it.

Start Menu > Visual Studio Installer > Modify

Sure enough, I missed the Unreal Engine Installer tick box on the side. The red underline is gone now that it is installed, but the error is still the same when I compile. “Cannot open include file: ‘crtdbg.h’: No such file or directory”

I closed Code and reopened it from the developer command prompt and went through the steps again.

Could you post your code just to double check that?

My code:

#include <iostream>

int main()
{
    std::cout << "Hello, World!";
    return 0;
}

My terminal:

C:\Unreal Course\Section2>cl TripleX.cpp

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\yvals.h(12): fatal error C1083: Cannot open include file: 'crtdbg.h': No such file or directory

My developer command prompt:

My Edit Configurations:

If you use the Visual Studio Installer and go to the individual components tab and search for “Universal” is the Universal C Runtime installed?

Yes, Universal C Runtime is installed.

I restarted my computer and now the error is gone and Hello, World finally printed!

Thank you for taking all this time to help me. Very sorry I missed that early checkbox. Now I know how to modify my installation if something like this ever comes up again.

Thanks again!

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.