0

I installed VS2015 and QtCreator 3.5 and compiled Qt5.5 from source as a binary distribution is not available for the visual c++ compiler shipped with VS2015.

I tried to compile my project which was developed using the visual c++ compilers from VS2012/VS2013 and QtCreator 3.3x with Qt 5.2 and Qbs - on a different machine - from QtCreator and with my new setup neither QtCreator nor Qbs from command line are able to link the application.

I narrowed the problem down using the Qbs helloworld example

import qbs

CppApplication {
   type: "application" // To suppress bundle generation on Mac
   consoleApplication: true
   files: "main.cpp"

    Depends {
        name: "Qt"
        submodules: [
            "core"
        ]
    }
}

Which gives the following output when building with qbs from the command line

compiling main.cpp
linking halloqbswelt.exe
ERROR: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\link.exe /nologo /DEBUG /PDB:halloqbswelt.pdb /OSVERSION:5.02 /SUBSYSTEM:CONSOLE,5.02 /MANIFEST /MANIFESTFILE:D:\projekte\halloqbswelt\Qt5-debug\halloqbswelt.Qt5.842abbdf\intermediate.halloqbswelt.exe.manifest D:\projekte\halloqbswelt\Qt5-debug\halloqbswelt.Qt5.842abbdf\.obj\3a52ce780950d4d9\main.cpp.obj .lib /OUT:D:\projekte\halloqbswelt\Qt5-debug\halloqbswelt.Qt5.842abbdf\intermediate.halloqbswelt.exe /LIBPATH:D:\projekte\3rd_party\qt\qtbase\lib
LINK : fatal error LNK1104: cannot open file '.lib'
ERROR: Process failed with exit code 1104.
The following products could not be built for configuration Qt5-debug:
    halloqbswelt

Rather cryptic so I'll highlight the problem from the above output

[...] .obj\3a52ce780950d4d9\main.cpp.obj .lib /OUT: [...]

So the empty .lib file is the problem.

Comparing the linker statement with that from the other machine, the empty .lib is at the same position where Qt5Core.lib should be. Thus tried to investigate why Qbs does not resolve the paths proberly; I looked at the core.qbs module but couldn't find anything different from the file on the machine with the working setup. Finally I decided to recompile the Qt library and setup the Qbs/QtCreator profiles from scratch. Done and it worked, until I restarted QtCreator, now neither (Qbs from command line, nor QtCreator with its own profile) works anymore.

Has somebody experienced such a behavior?

4

1 回答 1

0

正如评论中所说,http://article.gmane.org/gmane.comp.lib.qt.qbs/682给了我正确的起点。

Qbs 依赖于构建依赖项的每个子模块的 pri/prl 文件(据我了解)。在非前缀环境(这是 Windows 下的默认设置)(https://bugreports.qt.io/browse/QTBUG-42959)中安装从源代码构建的 Qt 时,这些 pri 文件被覆盖或发生其他一些坏事。

因此,使用前缀构建 Qt 并安装源代码可以解决问题,至少对我而言。

于 2015-08-23T18:10:05.433 回答