Skip to content

Visual studio 2019 build tools provides error C1034: iostream: no include path set The terminal process terminated with exit code: 2 #3654

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
NicTanghe opened this issue May 15, 2019 · 19 comments
Labels
not reproing We're not able to reproduce the issue (it's unlikely to get fixed until we find one). question tasks/build/debug An issue relating to tasks.json (e.g. build issues)

Comments

@NicTanghe
Copy link

NicTanghe commented May 15, 2019

Type: General
Input information below

Please review existing issues and our documentation at https://github.com/Microsoft/vscode-cpptools/tree/master/Documentation prior to filing an issue.

Describe the bug

  • OS and Version: widows 10
  • VS Code Version: code -v
    1.33.1
    51b0b28134d51361cf996d2f0a1c698247aeabd8
    x64

visual studio version:
NOT installed only build tools 2019 and c++ buildtools 2019

  • C/C++ Extension Version: current
  • Other extensions you installed (and if the issue persists after disabling them): some and yes
  • A clear and concise description of what the bug is.

Getting the following error when ompiling

helloworld.cpp
c:\Users\nicta\dev\c++\helloworld\helloworld.cpp(1): fatal error C1034: iostream: no include path set
The terminal process terminated with exit code: 2

To Reproduce
Please include code sample and task.json files.

c_cpp_properties.sjon
note same issue when using just "${workspaceFolder}/**", in include path

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**",
                "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.20.27508\\include",
                "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.17763.0\\ucrt",
                "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.17763.0\\um",
                "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.17763.0\\shared",
                "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.17763.0\\winrt",
                "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.17763.0\\cppwinrt"

            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],

            "windowsSdkVersion": "10.0.17763.0", 
            "intelliSenseMode": "msvc-x64",
            "compilerPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.20.27508\\bin\\Hostx64\\x64\\cl.exe",
            "cStandard": "c11",
            "cppStandard": "c++17"
        }
    ],
    "version": 4
}

task.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"
        }
    ]
}

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

i pres ctrlshift b to build.
ans select c/c+: cl.exe build active file
(cant select task.json ?)

Expected behavior
it builds

@sean-mcmanus
Copy link
Contributor

sean-mcmanus commented May 15, 2019

c_cpp_properties.json is just for configuring IntelliSense with our C/C++ extension and not building. The task.json has its own args you need to add something like
"/I", "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.20.27508\\include",
to the args.

@sean-mcmanus sean-mcmanus added tasks/build/debug An issue relating to tasks.json (e.g. build issues) question labels May 15, 2019
@bobbrow
Copy link
Member

bobbrow commented May 15, 2019

You shouldn't have to add the system include path to the task. Do you get the same error when you try compiling in the Developer Command Prompt with the same arguments?

@NicTanghe
Copy link
Author

It works from the development console it just gives some error about the semantics but it does compile.

Could the issue be that the task.json is just not showing up ?

@NicTanghe
Copy link
Author

NicTanghe commented May 18, 2019

without changing annything i now get the following error in vscode ??

fatal error LNK1112: module machine type 'x86' conflicts with target machine type 'x64'
The terminal process terminated with exit code: 1

(deleting obj file did not work)

@NicTanghe
Copy link
Author

NicTanghe commented May 19, 2019

For now i'm using a code runner to bind F8 to run cl on the current file. As a workaround

Issue not yet fixed

@bobbrow
Copy link
Member

bobbrow commented May 20, 2019

Are you saying that code runner works?
Did you open VS Code from inside the Developer Command Prompt so that it can inherit the build environment?

@NicTanghe
Copy link
Author

NicTanghe commented May 21, 2019

The code runner works and i opened VS Code from inside the Development console.
Do you need anny logs or info.

@bobbrow
Copy link
Member

bobbrow commented May 21, 2019

I am unable to reproduce your problem, but I don't know what's missing at this point. Perhaps it's because all of my machines have Visual Studio installed, but really that shouldn't matter since iostream comes with your BuildTools installation. If you type set in your VS Code terminal window (assuming CMD is your shell), do you see the correct build environment variables set?

@bobbrow bobbrow added the not reproing We're not able to reproduce the issue (it's unlikely to get fixed until we find one). label Jun 24, 2019
@bobbrow
Copy link
Member

bobbrow commented Jun 24, 2019

We are unable to reproduce this problem. If you have any additional information you can share, please let us know and we can reopen the issue and investigate further. Thank you!

@bobbrow bobbrow closed this as completed Jun 24, 2019
@yangshuang-developer
Copy link

I get the errors too,
fatal error LNK1112: module machine type 'x86' conflicts with target machine type 'x64'
config as the document say.

@yangshuang-developer
Copy link

env:
msbuild tools vs 2019, version 14.21.27702
start from Developer Command Prompt,
errors:
fatal error LNK1112

@yangshuang-developer
Copy link

@yangshuang-developer
Copy link

I finded the solution, you should start code frome x64 Native Tools Command Prompt.
The the link error LNK1112 is gone

@XankurX
Copy link

XankurX commented Jul 22, 2019

I ran into the same thing, but I was missing the first step from:
https://code.visualstudio.com/docs/cpp/config-msvc

i.e. "start VS Code from the Developer Command Prompt"

this one fixed it for me. It initializes all the needed env variables for you.

Thanks

@UtkarshBhatthere
Copy link

Are we required to start VS code from the Developer command prompt always ?? That's not convenient.

@sean-mcmanus
Copy link
Contributor

@UtkarshBhatthere Yes, but there's an issue tracking a potential fix for that at #5271 .

@vguttmann
Copy link

Dear People from the future looking to solve your issue: Here is what we have figured out so far:

  • In case you get the error C1034: iostream: no include path set: If you haven't already, start VS code from the Developer Command Prompt that is installed with the MSVC compiler set. If you have everything resolved now, very good. If not, continue.

  • In case you get the error fatal error LNK1112: module machine type 'x86' conflicts with target machine type 'x64', you need to start VS Code from the x64 Developer Command Prompt

@bobbrow I think you can ask this as issue as solved

@kosuruvarunkumar
Copy link

Hi, starting your Developer Command Prompt every time, then navigating to the project source, starting the app there... Using this process every time we write code and compile seems to be tedious. Is there any other way of doing this, where we can directly start the app, write code, compile, and run code.

@vguttmann
Copy link

Well, it is the only way to get it working, as of now. If you are want and are able to, you could write a small script or such for opening that. But I am by no means a developer here. I only had this issue, and I had been trying to understand this here for a solid hour, so I wrote this summarizing note so others have it easier.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
not reproing We're not able to reproduce the issue (it's unlikely to get fixed until we find one). question tasks/build/debug An issue relating to tasks.json (e.g. build issues)
Projects
None yet
Development

No branches or pull requests

8 participants