1

从下面的 gyp 文件生成 .sln 和 .vcxproj 后,msbuild 失败并出现

"C:\proj\test\test.sln" (默认目标) (1) -> (ValidateSolutionConfiguration target) ->
C:\proj\test\test.sln.metaproj : error MSB4126: The specified solution configuration "Default |X64" 无效。请使用配置和平台属性(例如 MSBuild.exe Solution.sln /p:Configuration=Debug /p:Platform="Any CPU")指定有效的解决方案配置,或将这些属性留空以使用默认解决方案配置. [C:\proj\test\test.sln]

如何让 gyp 生成 Default|x64 解决方案?

  {
    'targets': [
      {
        'target_name': 'test',
        'type': 'executable',
        'sources': [
          'test.cpp',          
        ],
      },
    ],
  }
4

1 回答 1

2

可能您需要声明目标配置并将其用作默认值target_default,类似于:

{
    'target_defaults': {
        'default_configuration': 'Release_x64',
        'configurations':
        {
            'Debug': {
                # configuration specific settings
            },
            'Release': {
                # configuration specific settings
            },
            'Debug_x64': {
                'inherit_from': ['Debug'],
                'msvs_configuration_platform': 'x64',
            },
            'Release_x64': {
                'inherit_from': ['Release'],
                'msvs_configuration_platform': 'x64',
            },
        },
    },

    'targets': [
        {
            'target_name': 'test',
            'type': 'executable',
            'sources': [
                'test.cpp',          
            ],
        },
    ],
}
于 2015-01-23T17:58:29.973 回答