Important: Please read the Qt Code of Conduct -

Compiling Qt Creator with Visual Studio (Cmake build), Error LNK1104 (file: cmake_pch.obj)

  • I am trying to build a Visual Studio solution for Qt Creator with Cmake. I have cloned the repo and checked out the tag 4.12.3.
    I have Qt and llvm and Perl as the description says, but when trying to configure with Cmake I get an error:

    CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
    Please set them or make sure they are set and tested correctly in the CMake files:
    linked by target "qtcreatorcdbext" in directory C:/Qtdev/QtCreatorSrc/src/libs/qtcreatorcdbext

    So there is an option (type: Path) "DbgEngLib" but it is not found, What is this DbgEngLib? I could not find anything in the description about it. There are also few other Path options which are shown as not found in CMake:


    Do I need any of these?

  • Lifetime Qt Champion

  • ah thanks, I got it working following the link you posted.
    Cmake configured successfully. But now I have another issue, when trying to compile Utils I get the error

    Error LNK1104 cannot open file 'C:\Qtdev\QtCreatorBld\src\libs\3rdparty\syntax-highlighting\QtCreatorPchConsole.dir\Debug\cmake_pch.obj'

    even though QtCreatorPchConsole compiles fine.

  • Lifetime Qt Champion

    @Gertio said in Building Qt Creator with CMake (DbgEngLib?):


    Does this file exist?

  • no.

    The error is the same with Sqlite...

    With Utils I had success to grab the files:

    C:\Qtdev\QtCreatorBld\src\libs\3rdparty\syntax-highlighting\QtCreatorPchConsole.dir\Debug\CMakeFiles\QtCreatorPchConsole.dir\cmake_pch.cxx.obj and

    put them into

    and remove the ".cxx" part so they become what is missing in the error.

    As for Sqlite, there are also cmake_pch.c.pch and cmake_pch.c.obj in C:\Qtdev\QtCreatorBld\src\libs\3rdparty\syntax-highlighting\QtCreatorPchConsole.dir\Debug\CMakeFiles\QtCreatorPchConsole.dir
    so doing same as above with these works for sqlite.

    Actually for Utils its

    and for Sqlite its

    got a little confused there

  • Well, still cant really compile stuff... this cmake_pch.obj error is popping up all over the place.

  • I also get a lot of these errors:
    LNK2038 mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in mocs_compilation.obj
    LNK2038 mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in mocs_compilation.obj

    when compiling

    Note this is when I manually copy the cmake_pch.cxx.pch and cmake_pch.cxx.obj into the directory described above and rename them. Otherwise I get

    Error LNK1104 cannot open file 'C:\Qtdev\QtCreatorBld\src\libs\3rdparty\syntax-highlighting\QtCreatorPchGui.dir\Debug\cmake_pch.obj'

Log in to reply