Компилятор C не может скомпилировать простую тестовую программу - PullRequest
0 голосов
/ 25 марта 2019

Я пытаюсь построить один проект из GitHub, а именно этот проект https://github.com/notAlaanor/cpp-type-highlighter (это просто репо другого парня).

Но после попытки скомпилировать, я получаю ошибку типа:

-- The C compiler identification is MSVC 19.20.27404.0
-- The CXX compiler identification is MSVC 19.20.27404.0
-- Check for working C compiler: E:/VS19/VC/Tools/MSVC/14.20.27404/bin/Hostx86/x86/cl.exe
-- Check for working C compiler: E:/VS19/VC/Tools/MSVC/14.20.27404/bin/Hostx86/x86/cl.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-3.13/Modules/CMakeTestCCompiler.cmake:52 (message):

The C compiler

        "E:/VS19/VC/Tools/MSVC/14.20.27404/bin/Hostx86/x86/cl.exe"

is not able to compile a simple test program.

It fails with the following output:

    Change Dir: C:/Users/theha/cpp-type-highlighter/build/CMakeFiles/CMakeTmp

    Run Build Command:"nmake" "/nologo" "cmTC_b368f\fast"
        E:\VS19\VC\Tools\MSVC\14.20.27404\bin\HostX64\x64\nmake.exe -f CMakeFiles\cmTC_b368f.dir\build.make /nologo -L                  CMakeFiles\cmTC_b368f.dir\build
    Building C object CMakeFiles/cmTC_b368f.dir/testCCompiler.c.obj
        E:\VS19\VC\Tools\MSVC\14.20.27404\bin\Hostx86\x86\cl.exe @C:\Users\theha\AppData\Local\Temp\nm8555.tmp
    testCCompiler.c
    Linking C executable cmTC_b368f.exe
        "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_b368f.dir --manifests  -- E:\MinGW\bin\ld.exe /nologo @CMakeFiles\cmTC_b368f.dir\objects1.rsp @C:\Users\theha\AppData\Local\Temp\nm85C3.tmp
    LINK Pass 1: command "E:\MinGW\bin\ld.exe /nologo @CMakeFiles\cmTC_b368f.dir\objects1.rsp /out:cmTC_b368f.exe /implib:cmTC_b368f.lib /pdb:C:\Users\theha\cpp-type-highlighter\build\CMakeFiles\CMakeTmp\cmTC_b368f.pdb /version:0.0 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\cmTC_b368f.dir/intermediate.manifest CMakeFiles\cmTC_b368f.dir/manifest.res" failed (exit code 1) with the following output:
    E:\MinGW\bin\ld.exe: cannot find /nologo: No such file or directory
    E:\MinGW\bin\ld.exe: cannot find /out:cmTC_b368f.exe: No such file or directory
    E:\MinGW\bin\ld.exe: cannot find /implib:cmTC_b368f.lib: No such file or directory
    E:\MinGW\bin\ld.exe: cannot find /pdb:C:\Users\theha\cpp-type-highlighter\build\CMakeFiles\CMakeTmp\cmTC_b368f.pdb: Invalid argument
    E:\MinGW\bin\ld.exe: cannot find /version:0.0: No such file or directory
    E:\MinGW\bin\ld.exe: cannot find /debug: No such file or directory
    E:\MinGW\bin\ld.exe: cannot find /INCREMENTAL: No such file or directory
    E:\MinGW\bin\ld.exe: cannot find /subsystem:console: No such file or directory
    E:\MinGW\bin\ld.exe: cannot find kernel32.lib: No such file or directory
    E:\MinGW\bin\ld.exe: cannot find user32.lib: No such file or directory
    E:\MinGW\bin\ld.exe: cannot find gdi32.lib: No such file or directory
    E:\MinGW\bin\ld.exe: cannot find winspool.lib: No such file or directory
    E:\MinGW\bin\ld.exe: cannot find shell32.lib: No such file or directory
    E:\MinGW\bin\ld.exe: cannot find ole32.lib: No such file or directory
    E:\MinGW\bin\ld.exe: cannot find oleaut32.lib: No such file or directory
    E:\MinGW\bin\ld.exe: cannot find uuid.lib: No such file or directory
    E:\MinGW\bin\ld.exe: cannot find comdlg32.lib: No such file or directory
    E:\MinGW\bin\ld.exe: cannot find advapi32.lib: No such file or directory
    E:\MinGW\bin\ld.exe: cannot find /MANIFEST: No such file or directory
    E:\MinGW\bin\ld.exe: cannot find /MANIFESTFILE:CMakeFiles\cmTC_b368f.dir/intermediate.manifest: Invalid argument
    CMakeFiles\cmTC_b368f.dir/manifest.res: file not recognized: file format not recognized
    NMAKE : fatal error U1077: '"C:\Program Files\CMake\bin\cmake.exe"' : return code '0xffffffff'
    Stop.
    NMAKE : fatal error U1077: 'E:\VS19\VC\Tools\MSVC\14.20.27404\bin\HostX64\x64\nmake.exe' : return code '0x2'
    Stop.




  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)


-- Configuring incomplete, errors occurred!

Если я запускаю команду where clang, я получаю вывод:

C:\Program Files\LLVM\bin\clang.exe

Также я запускаю команду от cmake .. до vcvarsall.bat, поэтому, прежде чем я выполню cmake .. Я бегу call "E:\VS19\VC\Auxiliary\Build\vcvarsall.bat" amd64.Я строил на Windows 10, у меня были Visual Studio 2019 и MinGW.

Как решить эту проблему?

1 Ответ

0 голосов
/ 25 марта 2019

Возможно, вам придется перенастроить и перестроить решение, если вы его загрузили.

Решение для щелчка правой кнопкой мыши -> Решение для ретаргетинга -> Выбрать relvent / latest SDK.

Решение правой кнопкой мыши -> Перестроить решение.

Надеюсь, это поможет.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...