[Qt-creator] qmake will not build c++ file named something like format.cc and ostream.cc

Morton Lin kemen209 at gmail.com
Sat Jul 22 04:13:37 CEST 2017


Hi Kai,

I got some new discovery. I think the file name is not an issue for the
qmake. In the example i provide, if i explicitly define the var
FMT_HEADER_ONLY  in the pro file:

DEFINES += FMT_HEADER_ONLY

It' will solve my building issue. But i still got two questions:

(1) In fact, the code(fmt/fmt.h) of spdlog had already defined this var,
see attached file : fmt_h, but this condition_var seems not visible to file
format.h and ostream.h, see attached file format_h and ostream_h. Why? Is
the file inclusion order wrong? But i found that fmt.h is first include[the
entries is the #include "spdlog/spdlog.h"].

(2) Even though i explicitly include format.cc and ostream.cc in the source
section of pro file, why is not been compiled(not been written to Makefile)?

Thanks,
Yun


On Wed, Jul 19, 2017 at 4:47 PM, Morton Lin <kemen209 at gmail.com> wrote:

> Hi Kai,
>
> I using qmake in Qt Creator. I made a test project. It failed when i try
> to build sub-module : logger, the log message is something like this:
>
> 16:26:34: Running steps for project test_name...
> 16:26:34: Starting: "/usr/local/Trolltech/Qt-4.8.6/bin/qmake"
> /Users/yunlin/depot/dev/test_name/logger/logger.pro -r -spec
> unsupported/macx-clang CONFIG+=x86_64
> 16:26:35: The process "/usr/local/Trolltech/Qt-4.8.6/bin/qmake" exited
> normally.
> 16:26:35: Starting: "/usr/bin/make"
> clang++ -c -pipe -std=c++11 -g -arch x86_64 -Wall -W -fPIC -DQT_GUI_LIB
> -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Trolltech/Qt-4.8.
> 6/mkspecs/unsupported/macx-clang -I../../test_name/logger
> -I/usr/local/Trolltech/Qt-4.8.6/lib/QtCore.framework/Versions/4/Headers
> -I/usr/local/Trolltech/Qt-4.8.6/include/QtCore
> -I/usr/local/Trolltech/Qt-4.8.6/lib/QtGui.framework/Versions/4/Headers
> -I/usr/local/Trolltech/Qt-4.8.6/include/QtGui
> -I/usr/local/Trolltech/Qt-4.8.6/include -I. -I../../test_name/logger -I.
> -F/usr/local/Trolltech/Qt-4.8.6/lib -o posix.o
> ../../test_name/logger/spdlog/fmt/bundled/posix.cc
> rm -f liblogger.1.0.0.dylib liblogger.dylib liblogger.1.dylib
> liblogger.1.0.dylib
> clang: warning: libstdc++ is deprecated; move to libc++ with a minimum
> deployment target of OS X 10.9 [-Wdeprecated]
> clang++ -headerpad_max_install_names -arch x86_64 -single_module
> -dynamiclib -compatibility_version 1.0 -current_version 1.0.0
> -install_name liblogger.1.dylib -o liblogger.1.0.0.dylib posix.o
>  -F/usr/local/Trolltech/Qt-4.8.6/lib -L/usr/local/Trolltech/Qt-4.8.6/lib
> -framework QtGui -L/usr/local/Trolltech/Qt-4.8.6/lib
> -F/usr/local/Trolltech/Qt-4.8.6/lib -framework QtCore
> Undefined symbols for architecture x86_64:
>   "fmt::SystemError::init(int, fmt::BasicCStringRef<char>, fmt::ArgList)",
> referenced from:
>       fmt::SystemError::SystemError(int, fmt::BasicCStringRef<char>) in
> posix.o
>       fmt::SystemError::SystemError<fmt::BasicCStringRef<char> >(int,
> fmt::BasicCStringRef<char>, fmt::BasicCStringRef<char> const&) in posix.o
>       fmt::SystemError::SystemError<int>(int, fmt::BasicCStringRef<char>,
> int const&) in posix.o
>       fmt::SystemError::SystemError<int, int>(int,
> fmt::BasicCStringRef<char>, int const&, int const&) in posix.o
>   "fmt::SystemError::~SystemError()", referenced from:
> ......
>
> spdlog is a logger i got from here: https://github.com/gabime/spdlog. It
> has a lots of header files, but only three cpp file : posix.cc, format.cc,
> and ostream.cc. It seems that in the above situation, the qmake only
> compiled posix.cc(build output confirmed that, since there is only one
> posix.o file there). I not sure it's a qmake bug or an environment issue.
> The attached 'Makefile' shows 'No rule to make target `ostream.o' or
> 'format.o'
>
> My OS is OS X 12.12.5, and my IDE is Qt Creator 4.3.1 Based on Qt 5.9.0
> (Clang 7.0 (Apple), 64 bit) {seems not irrelavant here, not sure}. BUT my
> building kits is qt 4.8.6, so is the qmake version.
>
>
>
> On Wed, Jul 19, 2017 at 3:03 PM, Kai Koehne <Kai.Koehne at qt.io> wrote:
>
>> Hi Morton,
>>
>>
>> Qt Creator doesn't build files itself - it merely wraps build systems
>> like qmake, qbs or CMake. Which are you using?
>>
>>
>> For qmake, I couldn't reproduce this in a quick test with two files names
>> format.cc and ostream.cc .
>>
>> Regards
>>
>>
>> Kai
>> ------------------------------
>> *From:* Qt-creator <qt-creator-bounces+kai.koehne=qt.io at qt-project.org>
>> on behalf of Morton Lin <kemen209 at gmail.com>
>> *Sent:* Saturday, July 8, 2017 10:02:27 AM
>> *To:* qt-creator at qt-project.org
>> *Subject:* [Qt-creator] qmake will not build c++ file named something
>> like format.cc and ostream.cc
>>
>> Hi All,
>>
>> I currently want to use spdlog(https://github.com/gabime/spdlog) in my
>> qt project. It contains two file named : format.cc and ostream.cc. The Qt
>> Creator will not build these two file even if i put it in my pro file.
>> Debugging show that it even not in the Makefile. After i struggled after
>> some time, i found out that if i changed the file name, all things worked
>> out.
>>
>> Is this behavior designed in this way? or there is bug? If it's by
>> designed, what' the reason here?
>>
>>
>> Thanks
>> Yun
>>
>>
>> Env:
>>
>> Qt 5.9.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by
>> Clang 7.0.2 (clang-700.1.81) (Apple)) on "cocoa"
>> OS: macOS Sierra (10.12) [darwin version 16.6.0]
>> Architecture: x86_64; features: SSE2 SSE3 SSSE3 SSE4.1 SSE4.2 AVX AVX2
>> Environment:
>> Features: QT_NO_EXCEPTIONS QT_NO_OPENSSL
>>
>> Qt Creator 4.3.1
>> Based on Qt 5.9.0 (Clang 7.0 (Apple), 64 bit)
>> From revision bfd818b2b1
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20170722/d76d1f0b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fmt_h.png
Type: image/png
Size: 199555 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20170722/d76d1f0b/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: format_h.png
Type: image/png
Size: 242466 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20170722/d76d1f0b/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ostream_h.png
Type: image/png
Size: 220322 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20170722/d76d1f0b/attachment-0002.png>


More information about the Qt-creator mailing list