【问题标题】:Visual Studio scripts don't set up environment variables correctlyVisual Studio 脚本未正确设置环境变量
【发布时间】:2018-12-22 08:27:04
【问题描述】:

我运行以下命令来设置我的环境:

PS C:\WINDOWS\system32> vcvarsall.bat x86_amd64
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.8.5
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x86_x64'

我有一个文件 test.cpp 只包含一行:#include <type_traits>,如下所示:

PS C:\Users\me\Documents\env-setup> cat .\test.cpp
#include <type_traits>

当我运行以下命令时出现错误:

PS C:\Users\me\Documents\env-setup> cl -c test.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.15.26730 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

test.cpp
test.cpp(1): fatal error C1034: type_traits: no include path set

谁能给我一个提示,为什么vcvarsall.bat 没有正确设置我的环境变量。我也尝试过vcvars64.batvcvars32.bat 和其他没有运气的人!

【问题讨论】:

  • 在命令提示符下尝试,而不是 PowerShell。
  • @RetiredNinja 你是对的。问题解决了:)

标签: visual-studio environment-variables nmake cl


【解决方案1】:

正如@RetiredNinja 评论的那样,我在 PowerShell 上运行命令。问题已通过使用命令提示符解决!

【讨论】:

    猜你喜欢
    • 2021-08-29
    • 1970-01-01
    • 2020-01-01
    • 2021-10-14
    • 2023-03-23
    • 1970-01-01
    • 1970-01-01
    • 2021-10-22
    • 2014-01-21
    相关资源
    最近更新 更多