无法通过命令行编译Visual Studio项目。我究竟做错了什么?

问题描述 投票:-1回答:1

我并不是真的想学习C / C ++,但我需要编译一个我将在Python中使用的实用程序的源代码。

安装说明说我需要运行CMake来构建Visual Studio项目。在我成功运行之后,我得到了这个输出

C:/metis-5.1.0\build\Windows>cmake -DCMAKE_CONFIGURATION_TYPES="Release" ..\..
-- Building for: Visual Studio 14 2015
-- Selecting Windows SDK version  to target Windows 10.0.17134.
-- The C compiler identification is MSVC 19.0.24210.0
-- The CXX compiler identification is MSVC 19.0.24210.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for execinfo.h
-- Looking for execinfo.h - not found
-- Looking for getline
-- Looking for getline - not found
-- Configuring done
-- Generating done
-- Build files have been written to: C:/metis-5.1.0/build/Windows

由于我需要为Python 3.5 x86构建上述内容,我认为最好的选择是使用Visual C ++ 2015 x86 x64交叉构建工具命令提示符因此我打开了该命令提示符并使用以下命令行来编译生成的项目(由上面创建)

C:\metis-5.1.0\build\Windows>MSBuild METIS.sln /property:Configuration=Release /property:Platform=x86
Microsoft (R) Build Engine version 14.0.25420.1
Copyright (C) Microsoft Corporation. All rights reserved.

Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 9/8/2018 8:36:45 PM.
Project "c:\metis-5.1.0\build\Windows\METIS.sln" on node 1 (default targets).
c:\metis-5.1.0\build\Windows\METIS.sln.metaproj : error MSB4126: The specified solutio
n configuration "Release|x86" is invalid. Please specify a valid solution configuration using the Configuration and Platform proper
ties (e.g. MSBuild.exe Solution.sln /p:Configuration=Debug /p:Platform="Any CPU") or leave those properties blank to use the defaul
t solution configuration. c:\metis-5.1.0\build\Windows\METIS.sln]
Done Building Project "c:\metis-5.1.0\build\Windows\METIS.sln" (default targets) -- FA
ILED.


Build FAILED.

c:\metis-5.1.0\build\Windows\METIS.sln" (default target) (1) ->
(ValidateSolutionConfiguration target) ->
  c:\metis-5.1.0\build\Windows\METIS.sln.metaproj : error MSB4126: The specified solut
ion configuration "Release|x86" is invalid. Please specify a valid solution configuration using the Configuration and Platform prop
erties (e.g. MSBuild.exe Solution.sln /p:Configuration=Debug /p:Platform="Any CPU") or leave those properties blank to use the defa
ult solution configuration. [c:\metis-5.1.0\build\Windows\METIS.sln]

    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.10

我究竟做错了什么 ?

更新:这是构建说明

The Visual Studio project will be called METIS.sln. Open it in Visual
Studio. If the configuration is not already "Release", set it to
"Release". Type F7 to build. The METIS library will be in
<BINARY_DIR>\libmetis\Release and the executable programs will be in
<BINARY_DIR>\programs\Release. (<BINARY_DIR> will be build\windows if
you used the command line or whatever you choose if using the CMake
GUI.) 

它们用于Visual Studio而不是命令行,所以我不知道是否必须设置“Release”标志并在哪里?

更新:将命令行更改为MSBuild METIS.sln / property:Configuration = Release / property:Platform = Win32解决了问题,但现在我收到其他错误:-(

visual-studio command-line cross-compiling
1个回答
0
投票

不得不将命令行Platform选项更改为Win32

© www.soinside.com 2019 - 2024. All rights reserved.