尽管设置了CC和CXX变量,但C编译器标识是未知的



我正在使用命令:

    cmake CC="C:Program Files (x86)Microsoft Visual Studio 12.0VCbincl.exe" 
CXX="C:Program Files (x86)Microsoft Visual Studio 12.0VCbincl.exe"  -G "Visual Studio 12
 Win64" -DBOOST_ROOT="c:localboost_1_56_0" -DBOOST_LIBRARYDIR="c:localboost_1_56_0lib64-
msvc-12.0"  ..

上面写着:

The C compiler identification is unknown

The CXX compiler identification is unknown

当我在那里设置这些变量时,这怎么可能呢?

编辑:错误日志文件:

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler:  
Build flags: 
Id flags: 
The output was:
1
Microsoft (R) Build Engine version 12.0.30723.0
[Microsoft .NET Framework, version 4.0.30319.18444]
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 21-09-2014 20:17:49.
Project "D:foobuildCMakeFiles3.0.2CompilerIdCCompilerIdC.vcxproj" on node 1 (default targets).
PrepareForBuild:
  Creating directory "Debug".
  Creating directory "DebugCompilerIdC.tlog".
InitializeBuildStatus:
  Creating "DebugCompilerIdC.tlogunsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
  C:Program Files (x86)Microsoft Visual Studio 12.0VCbinx86_amd64CL.exe /c /nologo /W0 /WX- /Od /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"Debug\" /Fd"Debugvc120.pdb" /Gd /TC /errorReport:queue CMakeCCompilerId.c
  CMakeCCompilerId.c
Link:
  C:Program Files (x86)Microsoft Visual Studio 12.0VCbinx86_amd64link.exe /ERRORREPORT:QUEUE /OUT:".CompilerIdC.exe" /INCREMENTAL:NO /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /PDB:".CompilerIdC.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:".CompilerIdC.lib" /MACHINE:X64 DebugCMakeCCompilerId.obj
LINK : fatal error LNK1181: cannot open input file 'gdi32.lib' [D:foobuildCMakeFiles3.0.2CompilerIdCCompilerIdC.vcxproj]
Done Building Project "D:foobuildCMakeFiles3.0.2CompilerIdCCompilerIdC.vcxproj" (default targets) -- FAILED.
Build FAILED.
"D:foobuildCMakeFiles3.0.2CompilerIdCCompilerIdC.vcxproj" (default target) (1) ->
(Link target) -> 
  LINK : fatal error LNK1181: cannot open input file 'gdi32.lib' [D:foobuildCMakeFiles3.0.2CompilerIdCCompilerIdC.vcxproj]
    0 Warning(s)
    1 Error(s)
Time Elapsed 00:00:00.47

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler:  
Build flags: 
Id flags: 
The output was:
1
Microsoft (R) Build Engine version 12.0.30723.0
[Microsoft .NET Framework, version 4.0.30319.18444]
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 21-09-2014 20:17:50.
Project "D:foobuildCMakeFiles3.0.2CompilerIdCXXCompilerIdCXX.vcxproj" on node 1 (default targets).
PrepareForBuild:
  Creating directory "Debug".
  Creating directory "DebugCompilerIdCXX.tlog".
InitializeBuildStatus:
  Creating "DebugCompilerIdCXX.tlogunsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
  C:Program Files (x86)Microsoft Visual Studio 12.0VCbinx86_amd64CL.exe /c /nologo /W0 /WX- /Od /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"Debug\" /Fd"Debugvc120.pdb" /Gd /TP /errorReport:queue CMakeCXXCompilerId.cpp
  CMakeCXXCompilerId.cpp
Link:
  C:Program Files (x86)Microsoft Visual Studio 12.0VCbinx86_amd64link.exe /ERRORREPORT:QUEUE /OUT:".CompilerIdCXX.exe" /INCREMENTAL:NO /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /PDB:".CompilerIdCXX.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:".CompilerIdCXX.lib" /MACHINE:X64 DebugCMakeCXXCompilerId.obj
LINK : fatal error LNK1181: cannot open input file 'gdi32.lib' [D:foobuildCMakeFiles3.0.2CompilerIdCXXCompilerIdCXX.vcxproj]
Done Building Project "D:foobuildCMakeFiles3.0.2CompilerIdCXXCompilerIdCXX.vcxproj" (default targets) -- FAILED.
Build FAILED.
"D:foobuildCMakeFiles3.0.2CompilerIdCXXCompilerIdCXX.vcxproj" (default target) (1) ->
(Link target) -> 
  LINK : fatal error LNK1181: cannot open input file 'gdi32.lib' [D:foobuildCMakeFiles3.0.2CompilerIdCXXCompilerIdCXX.vcxproj]
    0 Warning(s)
    1 Error(s)
Time Elapsed 00:00:00.50

编译器可以通过使用CCCXX变量来选择,但它比使用-G(生成器)参数要复杂得多。首先,路径中的斜杠必须是Unix风格(/),并且在第一次运行CMake配置后,除非清除缓存,否则它们不会生效。

可用发电机选项列表包括--help选项

Boost库的路径也必须使用Unix风格的斜杠(/)。许多命令将转换Windows路径,但在命令行传递定义时,您希望始终使用Unix样式的路径。

您的命令将更改为以下内容:

cmake-G"Visual Studio 12 2013 Win64"-DBOOT_ROOT="C:\local/browst_1_56_0"-DBOOT_LIBRARYDIR="C:\local/Browst_1_66_0/lib64-msvc-12.0".

您还需要确保为Visual Studio和x64正确设置了PATH环境变量。这可以通过使用以下命令打开VS2013 x64 Native Tools命令提示符轻松完成:

cmd /k "%VS120CoMNTOOLS%....VCvcvarsall.bat" amd64

此外,在尝试之前,您应该确保已清除cmake缓存。最简单的方法是删除cmake构建文件夹,但也可以使用cmake gui清除缓存。

最新更新