cl.exe找不到任何标准包含文件 [英] cl.exe not finding any standard include file

查看:1068
本文介绍了cl.exe找不到任何标准包含文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在msdn库中找到这个示例代码

I found this sample code on the msdn library

#include <iostream>

int main()
{
    std::cout << "This is a native C++ program." << std::endl;
    return 0;
}

如何从命令行编译本机C ++程序我将此代码存储在 file.cpp
然后转到命令提示符并输入

from How to Compile a Native C++ Program From the Command Line I store this code in file.cpp I then go to the command prompt and type this

输出如下:


当前路径> cl / EHsc file.cpp

Current Path> cl /EHsc file.cpp

Microsoft(R)32位C / C ++优化编译器版本15.00.30729.01 for 80x86

Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86

版权所有(C)Microsoft Corporation。保留所有权利。

Copyright (C) Microsoft Corporation. All rights reserved.

file.cpp
file.cpp(1):致命错误C1034:iostream:no include path set

file.cpp file.cpp(1) : fatal error C1034: iostream: no include path set

我将路径变量设置为mirosoft sdk,但我不知道该怎么做。

I have the path variable set to the mirosoft sdk but I don't know what to do.

我尝试了多个文件,如string.h和stdlib.h,但仍然没有运气。

I have tried multiple files like string.h and stdlib.h, but still no luck.

推荐答案

Visual C ++编译器对一大堆环境变量。获取这些设置正确的最简单的方法是使用在安装过程中在开始菜单上创建的Visual Studio命令提示符项,或从程序目录运行 vcvars32.bat

The Visual C++ compiler depends on a whole bunch of environment variables. The easiest way to get these set right is using the "Visual Studio Command Prompt" item created on the Start menu during the install, or running vcvars32.bat from the program directory.

否则,您必须设置 INCLUDE = LIB = 变量到正确的目录,然后才能成功编译。

Otherwise, you'll have to set INCLUDE= and LIB= variables to the proper directories before getting a successful compile.

这篇关于cl.exe找不到任何标准包含文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆