Fatal error c1034 stdio h не указан путь поиска включаемых файлов

OS Windows Vista Ultimate I am trying to run a program called minimal.c. When I type at the command line: C:UsersnathanDesktop>cl minimal.c Microsoft (R) 32-bit C/C++ Optimizing Compiler Versio...

OS Windows Vista Ultimate

I am trying to run a program called minimal.c. When I type at the command line:

C:UsersnathanDesktop>cl minimal.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86

Copyright (C) Microsoft Corporation.  All rights reserved.

minimal.c
minimal.c(5) : fatal error C1034: windows.h: no include path set

I have set all the paths:

C:UsersnathanDesktop>path
PATH=C:Program Files (x86)Microsoft Visual Studio 8VCbin;C:Windowssystem3
;C:Windows;C:WindowsSystem32Wbem;C:Program Files (x86)ATI TechnologiesAT
.ACECore-Static;C:Program FilesIntelDMIX;c:Program Files (x86)Microsoft S
L Server100ToolsBinn;c:Program Files (x86)Microsoft SQL Server100DTSBi
n;C:Program Files (x86)QuickTimeQTSystem;C:Program Files (x86)Javajdk1.
.0_13bin;C:Program Files (x86)AutodeskBackburner;C:Program Files (x86)Co
mon FilesAutodesk Shared;C:Program Files (x86)Microsoft DirectX SDK (March
009)Include;C:UsersnathanDesktopglut-3.7.6-binglut-3.7.6-bin;C:Program F
les (x86)Microsoft Visual Studio 8Common7IDE;C:Program Files (x86)Microsof
 Visual Studio 8VCPlatformSDKInclude;C:Program Files (x86)Microsoft Visual
Studio 8VCPlatformSDKIncludegl

I have gone and made sure windows.h is in the directory. I’m setting the path too. It’s
in C:Program Files (x86)Microsoft Visual Studio 8VCPlatformSDKInclude.

I have Visual Studio 2005.

I have exhausted all possibilities. Any ideas?

Peter Mortensen's user avatar

asked May 31, 2009 at 8:34

You could also run the vcvars32.bat file from the directory C:Program FilesMicrosoft Visual Studio 8VCbin (this is in your path) prior to your cl command.

Like this:

C:UsersnathanDesktop>vcvars32
C:UsersnathanDesktop>cl minimal.c

vcvars32 calls C:Program FilesMicrosoft Visual Studio 8Common7Toolsvsvars32.bat which sets up the required environment for compiling and linking.

The environment variables are INCLUDE, LIB, and PATH.

The compiler looks for header files in the INCLUDE path during compile, and libraries are fetched from the LIB path during link.

Peter Mortensen's user avatar

answered May 31, 2009 at 8:49

Kb.'s user avatar

Kb.Kb.

7,15013 gold badges55 silver badges74 bronze badges

2

For me, with Visual Studio 2017,

"C:Program Files (x86)Microsoft Visual Studio2017CommunityCommon7Toolsvsdevcmd.bat"

is the command to use before compiling with cl.

Here is the documentation.

Peter Mortensen's user avatar

answered May 8, 2018 at 21:12

khaverim's user avatar

khaverimkhaverim

3,2465 gold badges35 silver badges47 bronze badges

When you started the command line, did you run the included command line shortcut that comes with the Visual Studio setup? This will set the correct environment variables for you so that the compilation will work correctly.

answered May 31, 2009 at 8:39

1800 INFORMATION's user avatar

1800 INFORMATION1800 INFORMATION

130k29 gold badges159 silver badges239 bronze badges

In your project folder, open a PowerShell window and run:

cmd /c 'call "C:Program Files (x86)Microsoft Visual Studio2019BuildToolsVCAuxiliaryBuildvcvars64.bat" && cl minimal.c '

Peter Mortensen's user avatar

answered Mar 17, 2021 at 4:02

Guillermo De Los Santos's user avatar

1

You’ve added your INCLUDE paths to your PATH environment variable. Use vcvars32.bat as the others have suggested.

answered May 31, 2009 at 15:40

sean e's user avatar

sean esean e

11.7k3 gold badges43 silver badges56 bronze badges

Your path variable might be too long. Windows can’t take more than 1023 characters in the PATH environment variable.

Peter Mortensen's user avatar

answered Nov 14, 2011 at 22:52

aziz's user avatar

0

I had the same issue getting the

fatal error C1034: stdio.h: no include path set

and after running the C:Program FilesMicrosoft Visual Studio2022CommunityVCAuxiliaryBuild>vcvars64.bat cmd/batch script would get the

fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory

error message. From here, and other posts on that page, I suspected that the Windows 10 SDK package must be installed. After installation and running the vcvars64.bat script from the path mentioned above, the problem was solved.

P.S. As explained here, an alternative to manually finding and running the above cmd/batch script, you may just do Windows Key+Q and search for Developer Command Prompt for ..., in my case it is Developer Command Prompt for VS 2022.

answered Feb 28, 2022 at 20:28

Foad S. Farimani's user avatar

Foad S. FarimaniFoad S. Farimani

11.8k15 gold badges67 silver badges177 bronze badges

if you have version 2017 of the compiler cl.exe (you installed Visual Studio 2017), in the command prompt you need go to «C:Program Files (x86)Microsoft Visual Studio2017ProfessionalVCAuxiliaryBuild» and run ‘vcvars32.bat’ for x86 compilation or vcvars64.bat for x64 compilation.

Содержание

  1. Fatal error c1034 stdio h не указан путь поиска включаемых файлов
  2. Answered by:
  3. Question
  4. Answers
  5. Как добавить компилятор Visual Studio C++ в powershellcmd?
  6. Fatal error c1034 stdio h не указан путь поиска включаемых файлов
  7. Fatal error c1034 stdio h не указан путь поиска включаемых файлов
  8. Fatal error c1034 stdio h не указан путь поиска включаемых файлов
  9. Asked by:
  10. Question
  11. All replies

Fatal error c1034 stdio h не указан путь поиска включаемых файлов

Answered by:

Question

I am an absolute beginner of C programming. I downloaded MS VC++ 2008 Express Edition onto my system (Vista Business 32 bit, 1GB RAM, 1.8 GHz and 250GB HDD). I set an Environment Variable PATH to «C:Program FilesMicrosoft Visual Studio 9.0VCbin;» so that I can run my programs in my local directory (D:Pcpp).

1) After setting the Environment Variable PATH, I tested for the compiler by typing «cl» on command prompt under directory «D:Pcpp». I got the O/P that is expected-

usage: cl [ option. ] filename. [ /link linkoption. ]

2) Then I went for a simple program by typing «notepad simple.c» under directory «D:Pcpp». The program is

int main()
<
printf(«This is a native C program.n»);
return 0;
>

3) Then compiled the program by typing «cl simple.c» under «D:Pcpp» directory

4) To my disappointment, an error occurred. The error is

simple.c(1) : fatal error C1034: stdio.h: no include path set

Whats wrong with my program?

A step by step guidance will br very much appreciated.

Thanks in advance

Answers

The compiler has to know the path(s) to the header files (such as stdio.h).

There are a number of ways this can be specified. Normally it is specified
via an environment variable — INCLUDE=

The linker also has to know the path(s) to the lib files to be linked.
Again, there are a number of ways this can be specified.
Normally it is specified via an environment variable — LIB=

If you open the command prompt console window from within the IDE by
using the menu item:

Tools->Visual Studio 2008 Command Prompt

these environment variables will be set up for you automatically.

The file vcvars32.bat is where these are configured for 32-bit builds.
It’s in the VC++ bin directory.

You can also specify the include file directory via the /I switch when
invoking cl.exe — type cl /? to see all of the options available. Note
the linker options as well.

As a self-professed «absolute beginner» you would be well-advised to
use the IDE for doing your programming. It will configure many things
for you — especially if you use the supplied project templates. There
are many things you have to consider when building using the command
line tools, which most beginners won’t be able to cope with initially.

Источник

Как добавить компилятор Visual Studio C++ в powershellcmd?

Есть установленная Студия 2015.
Добавил в PATH C:Program Files (x86)Microsoft Visual Studio 14.0VCbincl.exe
Создал тестовую программу(Hello World). При запуске cl test.cpp матерится:

Гугл посоветовал запустить скрипт C:Program Files (x86)Microsoft Visual Studio 14.0Common7Toolsvsvars32. Запустил. Нифига, ошибка осталась.
Вопрос: как все-таки запустить этот чертов компилятор из дефолтной командной строки?

  • Вопрос задан более трёх лет назад
  • 5527 просмотров

Простой 2 комментария

В PATH нужно добавлять каталог (C:Program Files (x86)Microsoft Visual Studio 14.0VCbin), а не cl.exe

Но ошибка говорит, что у вас не указан путь поиска ВКЛЮЧАЕМЫХ файлов.
То есть сам cl.exe находит. Вам нужно добавить опцию /I или -I с указанием, где include файлы лежат

cl.exe -Ic:src test.cpp

Для основных проектов я вытащил несколько ярлыков на раб.стол и в рабочей папке ярлыка указал каталог проекта. Просто запускаешь с ярлыка, выполняется настройка среды и ты в папке проекта.
Для остального, да приходится командами менять текущий каталог.

Если немного заморочиться можно руками добавить аналогичный пункт в контекстное меню с предварительным запуском скрипта настройки среды.

Компиляция из cmd через cl.exe — задание необходимого окружения.
Чтобы задать в глобальное окружение системные переменные — добавьте к Path и создайте Include, LIB.
И поменяйте на ваши версии MSVC, Windows SDK и разрядность x86 или x64.

Чтобы проверить переменные — можно просто запустить со стартового меню — x64 Native Tools Command Prompt for VS 2019 и набрать «set path» или «set lib», или «set include».

Path

  • C:Program Files (x86)Microsoft Visual Studio2019CommunityVCToolsMSVC14.24.28314binHostX64x64

Include

  • C:Program Files (x86)Microsoft Visual Studio2019CommunityVCToolsMSVC14.24.28314ATLMFCinclude
  • C:Program Files (x86)Microsoft Visual Studio2019CommunityVCToolsMSVC14.24.28314include
  • C:Program Files (x86)Windows Kits10include10.0.18362.0ucrt
  • C:Program Files (x86)Windows Kits10include10.0.18362.0shared
  • C:Program Files (x86)Windows Kits10include10.0.18362.0um
  • C:Program Files (x86)Windows Kits10include10.0.18362.0winrt
  • C:Program Files (x86)Windows Kits10include10.0.18362.0cppwinrt

LIB

  • C:Program Files (x86)Microsoft Visual Studio2019CommunityVCToolsMSVC14.24.28314ATLMFClibx64
  • C:Program Files (x86)Microsoft Visual Studio2019CommunityVCToolsMSVC14.24.28314libx64
  • C:Program Files (x86)Windows Kits10lib10.0.18362.0ucrtx64
  • C:Program Files (x86)Windows Kits10lib10.0.18362.0umx64

Источник

Fatal error c1034 stdio h не указан путь поиска включаемых файлов

Yes, and since this has the ability to run a terminal, if you use this to run cmd.exe then:

This inherits the environment from VS Code, so it will show you the environment. The LIB environment variable is the one that contains the path to libcmt(d).lib. So to show this:

However, and this is vitally important, this is not enough to get the application to link. You need to add the correct Windows SDK library directories to the LIB path too. The first you will need is:

C:Program Files (x86)Windows Kits10lib ucrt

Visual Studio 2015 and newer does not come with a C runtime. It has been part of Windows since Windows 10. So you need to have the UCRT libraries in the library path. There is no getting around this, you will always need the Windows 10 SDK installed when you are using Visual Studio 2015, 2017 or 2019. The Visual C++ runtime is written exclusively to use the UCRT.

The second thing that you need in the library path is the path to kernel32.lib. The startup code (libcmt.lib/msvcrt.lib) makes use of Windows API functions.

The reason why I have been questioning your environment is simply because I do not see any problems using Visual Studio code to build C++ on a properly working environment. So in order to figure out what could be happening, I have been trying to get as much information as possible to try to reasonably figure this out. Since VS code uses the Visual Studio command prompt environment to correctly set up the environment for Visual C++, it means that it uses the LIB environment variable set in the developer command prompt.

This means that if Visual Studio code is failing to find libcmt.lib but the developer command prompt is finding it then this means that you have to be changing the LIB path when you start VS code.

Also, if you are trying to avoid using the Windows 10 SDK for reasons like «I want to run my application on a version of Windows older than Windows 10» then just install the Windows 10 SDK and use it. The Windows 10 SDK is able to build applications that runs on versions of Windows all the way back to Vista or older if you know what you are doing, but this isn’t supported. There are actually few good reasons to not use the Windows 10 SDK when you are building desktop applications. Even if you do find a good one, you still need part of the Windows 10 SDK installed to get applications to build anyway.

This is a signature. Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.

Источник

Fatal error c1034 stdio h не указан путь поиска включаемых файлов

Yes, and since this has the ability to run a terminal, if you use this to run cmd.exe then:

This inherits the environment from VS Code, so it will show you the environment. The LIB environment variable is the one that contains the path to libcmt(d).lib. So to show this:

However, and this is vitally important, this is not enough to get the application to link. You need to add the correct Windows SDK library directories to the LIB path too. The first you will need is:

C:Program Files (x86)Windows Kits10lib ucrt

Visual Studio 2015 and newer does not come with a C runtime. It has been part of Windows since Windows 10. So you need to have the UCRT libraries in the library path. There is no getting around this, you will always need the Windows 10 SDK installed when you are using Visual Studio 2015, 2017 or 2019. The Visual C++ runtime is written exclusively to use the UCRT.

The second thing that you need in the library path is the path to kernel32.lib. The startup code (libcmt.lib/msvcrt.lib) makes use of Windows API functions.

The reason why I have been questioning your environment is simply because I do not see any problems using Visual Studio code to build C++ on a properly working environment. So in order to figure out what could be happening, I have been trying to get as much information as possible to try to reasonably figure this out. Since VS code uses the Visual Studio command prompt environment to correctly set up the environment for Visual C++, it means that it uses the LIB environment variable set in the developer command prompt.

This means that if Visual Studio code is failing to find libcmt.lib but the developer command prompt is finding it then this means that you have to be changing the LIB path when you start VS code.

Also, if you are trying to avoid using the Windows 10 SDK for reasons like «I want to run my application on a version of Windows older than Windows 10» then just install the Windows 10 SDK and use it. The Windows 10 SDK is able to build applications that runs on versions of Windows all the way back to Vista or older if you know what you are doing, but this isn’t supported. There are actually few good reasons to not use the Windows 10 SDK when you are building desktop applications. Even if you do find a good one, you still need part of the Windows 10 SDK installed to get applications to build anyway.

This is a signature. Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.

Источник

Fatal error c1034 stdio h не указан путь поиска включаемых файлов

This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.

Asked by:

Question

I’m using VSCode for a small C project.

Been trying to compile with gcc.exe from Mingw but it doesn’t have whice I need for my code (although it has and other headers. but these things are beyond my understanding).

So, I tried compiling with cl.exe but apparently it has it’s own problems.

I get the error message:

fatal error C1034: stdio.h: no include path set

Any Ideas where has gone? Can’t people code in C with peace?

  • Moved by Jack Zhai-MSFT Microsoft contingent staff Monday, January 20, 2020 6:56 AM

This depends on the version of Visual Studio you are using to get cl.exe. Not Visual Studio Code here, but you must have at least one other Visual Studio product installed to get cl.exe.

If it is Visual Studio 2013 or older then it is is part of the headers. If it is Visual Studio 2015 or newer then you will also need to install the Windows 10 SDK.

But anyway, I don’t think that is your problem. Look at the error message carefully, it is saying that you have not set the include path. Basically this is saying that you have not told cl.exe where to find any headers. To put it another way, you have not set up the C++ environment properly.

If you look at the documentation for the #include directive it will tell you what cl.exe will look at to figure out the include paths. However it is important to point out that it doesn’t use a specs file in the same way that gcc does, so cl.exe doesn’t use any hard coded paths.

According to Configure Visual Studio Code for Microsoft C++, they start Visual Studio Code through the Visual Studio developer command prompt in order to inherit the C++ environment that way.

This is a signature. Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.

First of all, I have Windows 10 sdk and Visual studio Build tools 2017.

Second, I’d already tried compiling through the Developer Command Prompt for VS.

. 2017BuildTools> cl.exe «d:myProjcode.c»

So according to the error and you said (Darran Rowe), if even when being run through the Devcmd is not good enough and the only thing is adding path to header files.

I can only add one path and in windows sdk, there are 3-4 folder of header files.

Right now this is a completely different issue. If you have the Windows SDK installed and it is producing this error either you didn’t install the SDK option to include the headers and libraries, changed the INCLUDE environment variable and removed the UCRT path or the SDK failed to install correctly.

The developer command automatically uses the C++ paths, for example running the developer command prompt and running set gives me:

See how the INCLUDE environment variable has the Windows SDK in the path, and especially important is the UCRT path?

Notice how stdio.h can be found in that directory? So the developer command prompt or any of the specific platform command prompts automatically set up the include environment properly for building. If it cannot build a basic C/C++ source file on the command line then there is something wrong with your system.

So you should check the following things.

1) If you are changing the INCLUDE environment variable, make sure that you are doing set INCLUDE= ;%INCLUDE%. This will keep the current INCLUDE environment variable intact.

2) Check the INCLUDE environment variable set in the developer command prompt. You can use either set without any parameters or echo %INCLUDE% to find this.

3) The Windows 10 UCRT path should contain stdio.h. If the INCLUDE environment variable is set correctly, check to see if the file exists on disk. You can either use dir on the command prompt or use explorer to find this.

This is a signature. Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.

I followed your instructions and there’s a progress.

My INCLUDE variable wasn’t pointing to my windows kit include paths (why?).

and checked that everything is alright.

After that, I checked if my vscode can now compile . But I recieved a new error:

I thought maybe to run it manually in developer cmd for vs and indeed it finally run smoothly with no errors.

So even though it’s a pain in the ass to run it manually, the problem is basically solved.

However now it seems the all of it was in vane. When I use the function I imported the header for, I get:

error LNK2019: unresolved external symbol _NtQueryInformationProcess@20 referenced in function _main

And according to a post I saw, those functions can only be loaded dynamically (how is it possible)?

If you have anything to add or comment, please do.

The fact that your developer command prompt isn’t adding the Windows SDK paths to the command prompt environment actually shows that there is something wrong with the Windows SDK installation.

The command prompt environment looks into the registry to see if it can find a registered Windows 10 or as a fall back, the 8.1 SDK. If it doesn’t find one of these then it will just not set any environment variables. So do you have a Windows 10 or the Windows 8.1 SDK installed?

As for NtQueryInformationProcess, this is a function that is in NTDLL.dll. There is normally no import library for in the Windows SDK for NTDLL. This means that you are going to have to use LoadLibrary/GetModuleHandle to get a handle to NTDLL.dll and then use GetProcAddress to get a pointer to this function. As an example:

This will dynamically get a pointer to NtQueryInformationProcess and the use of GetModuleHandle is safe in this case because NTDLL is required by kernel32.dll.

This is a signature. Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.

So do you have any idea why I use cl.exe through vscode plugin and get that:

I mean, I should check online for answer, but I don’t understand why it isn’t like running from devcmd.

Also, there seems to be a library for NTDLL.dll funcions and structures: winternl.h

I saw usage of the library without doing dynamic loading at:

https://www.exploit-db.com/exploits/44463 (I hope you know that website, I don’t you to be suspicious).

So do you have any idea why I use cl.exe through vscode plugin and get that:

I mean, I should check online for answer, but I don’t understand why it isn’t like running from devcmd.

When you do a «set» from the command line in both environments, look at these
environment variables:

When you use the dev tools command prompt you are probably seeing the Windows
Kits specified there.

When you say both environments.

The first one is within the dev tool command prompt (with my patched include variable).

The second is an extension for c/c++ in my visual studio code. (which I have problem — the Link error)

Just making sure we’re on the same page.

I can’t really check with «set» what is going on there, I only have a keyboard shortcut to build exe.

I really thank you both for helping me, by the way, and I know that it might be question I should refer to other forum in that specific matter, but if you have a lead or idea.

Yes, and since this has the ability to run a terminal, if you use this to run cmd.exe then:

This inherits the environment from VS Code, so it will show you the environment. The LIB environment variable is the one that contains the path to libcmt(d).lib. So to show this:

However, and this is vitally important, this is not enough to get the application to link. You need to add the correct Windows SDK library directories to the LIB path too. The first you will need is:

C:Program Files (x86)Windows Kits10lib ucrt

Visual Studio 2015 and newer does not come with a C runtime. It has been part of Windows since Windows 10. So you need to have the UCRT libraries in the library path. There is no getting around this, you will always need the Windows 10 SDK installed when you are using Visual Studio 2015, 2017 or 2019. The Visual C++ runtime is written exclusively to use the UCRT.

The second thing that you need in the library path is the path to kernel32.lib. The startup code (libcmt.lib/msvcrt.lib) makes use of Windows API functions.

The reason why I have been questioning your environment is simply because I do not see any problems using Visual Studio code to build C++ on a properly working environment. So in order to figure out what could be happening, I have been trying to get as much information as possible to try to reasonably figure this out. Since VS code uses the Visual Studio command prompt environment to correctly set up the environment for Visual C++, it means that it uses the LIB environment variable set in the developer command prompt.

This means that if Visual Studio code is failing to find libcmt.lib but the developer command prompt is finding it then this means that you have to be changing the LIB path when you start VS code.

Also, if you are trying to avoid using the Windows 10 SDK for reasons like «I want to run my application on a version of Windows older than Windows 10» then just install the Windows 10 SDK and use it. The Windows 10 SDK is able to build applications that runs on versions of Windows all the way back to Vista or older if you know what you are doing, but this isn’t supported. There are actually few good reasons to not use the Windows 10 SDK when you are building desktop applications. Even if you do find a good one, you still need part of the Windows 10 SDK installed to get applications to build anyway.

This is a signature. Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.

Источник

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:Usersnictadevc++helloworldhelloworld.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

Found 3141232 threads

  • large check mark

    loading

  • large check mark

    loading

  • large check mark

    loading

  • large check mark

    loading

  • large check mark

    loading

  • large check mark

    loading

  • large check mark

    loading

  • large check mark

    loading

  • large check mark

    loading

  • large check mark

    loading

  • large check mark

    loading

  • large check mark

    loading

  • large check mark

    loading

  • large check mark

    loading

  • large check mark

    loading

  • large check mark

    fatal error LN1107

    I am trying to include an object file (.o extension)

    >in my program

    >1>GeoTools.o : fatal error LNK1107: invalid or …


    Answered

    |
    4 Replies
    |
    3628 Views
    |

    Created by
    BluBlaud —
    Monday, November 28, 2011 8:28 PM

    |

    Last reply
    by
    WayneAKing —
    Tuesday, November 29, 2011 7:06 AM

    loading

  • large check mark

    loading

  • large check mark

    loading

  • large check mark

    MASM fatal error A1018

    fatal error A1018: COFF error writing file»

    According to this error message, it seems related to the system error.


    Answered

    |
    2 Replies
    |
    482 Views
    |

    Created by
    clouseu —
    Monday, July 25, 2016 2:48 PM

    |

    Last reply
    by
    宝宝徐 —
    Tuesday, July 26, 2016 7:19 AM

    loading

  • large check mark

    loading

  • Items 1 to 20 of 3141232

    Next ›

Found 3141232 threads

  • large check mark

    loading

  • large check mark

    loading

  • large check mark

    loading

  • large check mark

    loading

  • large check mark

    loading

  • large check mark

    loading

  • large check mark

    loading

  • large check mark

    loading

  • large check mark

    loading

  • large check mark

    loading

  • large check mark

    loading

  • large check mark

    loading

  • large check mark

    loading

  • large check mark

    loading

  • large check mark

    loading

  • large check mark

    fatal error LN1107

    I am trying to include an object file (.o extension)

    >in my program

    >1>GeoTools.o : fatal error LNK1107: invalid or …


    Answered

    |
    4 Replies
    |
    3628 Views
    |

    Created by
    BluBlaud —
    Monday, November 28, 2011 8:28 PM

    |

    Last reply
    by
    WayneAKing —
    Tuesday, November 29, 2011 7:06 AM

    loading

  • large check mark

    loading

  • large check mark

    loading

  • large check mark

    MASM fatal error A1018

    fatal error A1018: COFF error writing file»

    According to this error message, it seems related to the system error.


    Answered

    |
    2 Replies
    |
    482 Views
    |

    Created by
    clouseu —
    Monday, July 25, 2016 2:48 PM

    |

    Last reply
    by
    宝宝徐 —
    Tuesday, July 26, 2016 7:19 AM

    loading

  • large check mark

    loading

  • Items 1 to 20 of 3141232

    Next ›

Есть установленная Студия 2015.
Добавил в PATH C:Program Files (x86)Microsoft Visual Studio 14.0VCbincl.exe
Создал тестовую программу(Hello World). При запуске cl test.cppматерится:

test.cpp(1): fatal error C1034: iostream: не указан путь поиска включаемых файлов

Гугл посоветовал запустить скрипт C:Program Files (x86)Microsoft Visual Studio 14.0Common7Toolsvsvars32. Запустил. Нифига, ошибка осталась.
Вопрос: как все-таки запустить этот чертов компилятор из дефолтной командной строки?


  • Вопрос задан

    более трёх лет назад

  • 5595 просмотров

В PATH нужно добавлять каталог (C:Program Files (x86)Microsoft Visual Studio 14.0VCbin), а не cl.exe

Но ошибка говорит, что у вас не указан путь поиска ВКЛЮЧАЕМЫХ файлов.
То есть сам cl.exe находит. Вам нужно добавить опцию /I или -I с указанием, где include файлы лежат

cl.exe -Ic:src test.cpp

Пригласить эксперта

Со студией поставляется комплект командных сценариев, настраивающих окружение командной строки для работы компилятора. Достаточно командную строку запускать через эти сценарии. Ярлыки на эти сценарии находятся в меню Пуск в папке студии.
Например у меня для VS2017 есть такие:
x64 Native Tools Command Prompt for VS 2017
x86 Native Tools Command Prompt for VS 2017
Соответственно для 64битной и 32битной сборки приложений. В 2015 студии есть аналогичные, только название немного изменено.
Запускайте ком.строку через этот сценарий и все будет собираться.

Компиляция из cmd через cl.exe — задание необходимого окружения.
Чтобы задать в глобальное окружение системные переменные — добавьте к Path и создайте Include, LIB.
И поменяйте на ваши версии MSVC, Windows SDK и разрядность x86 или x64.

Чтобы проверить переменные — можно просто запустить со стартового меню — x64 Native Tools Command Prompt for VS 2019 и набрать «set path» или «set lib», или «set include».

Path

  • C:Program Files (x86)Microsoft Visual Studio2019CommunityVCToolsMSVC14.24.28314binHostX64x64

Include

  • C:Program Files (x86)Microsoft Visual Studio2019CommunityVCToolsMSVC14.24.28314ATLMFCinclude
  • C:Program Files (x86)Microsoft Visual Studio2019CommunityVCToolsMSVC14.24.28314include
  • C:Program Files (x86)Windows Kits10include10.0.18362.0ucrt
  • C:Program Files (x86)Windows Kits10include10.0.18362.0shared
  • C:Program Files (x86)Windows Kits10include10.0.18362.0um
  • C:Program Files (x86)Windows Kits10include10.0.18362.0winrt
  • C:Program Files (x86)Windows Kits10include10.0.18362.0cppwinrt

LIB

  • C:Program Files (x86)Microsoft Visual Studio2019CommunityVCToolsMSVC14.24.28314ATLMFClibx64
  • C:Program Files (x86)Microsoft Visual Studio2019CommunityVCToolsMSVC14.24.28314libx64
  • C:Program Files (x86)Windows Kits10lib10.0.18362.0ucrtx64
  • C:Program Files (x86)Windows Kits10lib10.0.18362.0umx64

60084d043d7b6629048124.png
60084d0b6866d772151105.png
60084d10b1868232917890.png

Также можно установить переменную окружения CL /MD чтобы создавать код с Динамической линковкой библиотек среды выполнения для меньшего размера исполняемого файла — по умолчанию /MT release с статической линковкой.
Еще можно переопределить опцию из cmd с сообщением предупреждения о смене опции.
https://docs.microsoft.com/en-us/previous-versions…
https://docs.microsoft.com/en-us/previous-versions…

600878d7374bc198614365.png


  • Показать ещё
    Загружается…

09 февр. 2023, в 18:25

5000 руб./за проект

09 февр. 2023, в 18:23

2500 руб./за проект

09 февр. 2023, в 17:54

1000 руб./за проект

Минуточку внимания

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Fatal error c1010 непредвиденный конец файла во время поиска предкомпилированного заголовка
  • Fatal error c1010 unexpected end of file while looking for precompiled header
  • Fatal error c1007 fortran
  • Fatal error c1004 unexpected end of file found
  • Fatal error c1003

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии