The C compiler is not able to compile a simple test program

0

I'm trying to build one project from the GitHub, namely this project https://github.com/notAlaanor/cpp-type-highlighter (it's just repo of another guy).

But after trying to compile it I get an erros like:

-- 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!

If I run command where clang I get an output:

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

Also I run command cmake .. through vcvarsall.bat, so, before I run cmake .., I run call "E:\VS19\VC\Auxiliary\Build\vcvarsall.bat" amd64. I building on Windows 10, I had Visual Studio 2019 and MinGW.

How to fix that issue?

c++
build
cmake
asked on Stack Overflow Mar 24, 2019 by adziri • edited Mar 24, 2019 by Tsyvarev

1 Answer

-1

You may have to retarget and rebuild the solution if you've downloaded it.

Right click solution -> Retarget solution -> Select relvent/latest SDK.

Right click solution -> Rebuild Solution.

Hope that helps.

answered on Stack Overflow Mar 24, 2019 by Kaylum Snape

User contributions licensed under CC BY-SA 3.0