'How to use CuteLogger in a Qt qmake based project, on macOS?
I was able to build the CuteLogger library on macOS with
git clone [email protected]:dept2/CuteLogger.git
- debug
mkdir x64d
cd x64d
cmake .. -DCMAKE_TOOLCHAIN_FILE=~/vcpk/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Debug
cmake --build . --config Debug
- release
mkdir x64
cd x64
cmake .. -DCMAKE_TOOLCHAIN_FILE=~/vcpk/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release
That led to
x64d/libCuteLogger.dylib ~40M
x64/libCuteLogger.dylib ~33M
which I included in another project, the one which comes in the cutelogger README
#include <QCoreApplication>
#include <Logger.h>
#include <ConsoleAppender.h>
int main(int argc, char* argv[])
{
QCoreApplication app(argc, argv);
ConsoleAppender* consoleAppender = new ConsoleAppender;
consoleAppender->setFormat("[%{type:-7}] <%{Function}> %{message}\n");
cuteLogger->registerAppender(consoleAppender);
LOG_INFO("Starting the application");
int result = app.exec();
if (result)
LOG_WARNING() << "Something went wrong." << "Result code is" << result;
return result;
}
And I build this with qmake
QT -= gui
CONFIG(debug, debug|release) {
d = d
} else {
}
INCLUDEPATH += ../include
LIBS += -L$$PWD/../x64$$d -lCuteLogger
SOURCES += \
main.cpp
mySetOfExtraFiles.files += $$PWD/../x64$$d/libCuteLogger.dylib
mySetOfExtraFiles.path = Contents/Frameworks
QMAKE_BUNDLE_DATA += mySetOfExtraFiles
But running it gives
objc[23564]: Class QMacAutoReleasePoolTracker is implemented in both /Users/user/QtProjects/Cutelogger/x64d/libCuteLogger.dylib (0x1122ae5a0)
and /Users/user/QtProjects/CuteLoggerProject/_x64d/CuteLoggeProject.app/Contents/MacOS/CuteLoggeProject (0x10f0ec0f0). One of the two will be used. Which one is undefined.
objc[23564]: Class QT_ROOT_LEVEL_POOL__THESE_OBJECTS_WILL_BE_RELEASED_WHEN_QAPP_GOES_OUT_OF_SCOPE is implemented in both /Users/user/QtProjects/Cutelogger/x64d/libCuteLogger.dylib (0x1122ae618)
and /Users/user/QtProjects/CuteLoggerProject/_x64d/CuteLoggeProject.app/Contents/MacOS/CuteLoggeProject (0x10f0ec168). One of the two will be used. Which one is undefined.
objc[23564]: Class KeyValueObserver is implemented in both /Users/user/QtProjects/Cutelogger/x64d/libCuteLogger.dylib (0x1122ae640)
and /Users/user/QtProjects/CuteLoggerProject/_x64d/CuteLoggeProject.app/Contents/MacOS/CuteLoggeProject (0x10f0ec190). One of the two will be used. Which one is undefined.
objc[23564]: Class RunLoopModeTracker is implemented in both /Users/user/QtProjects/Cutelogger/x64d/libCuteLogger.dylib (0x1122ae690)
and /Users/user/QtProjects/CuteLoggerProject/_x64d/CuteLoggeProject.app/Contents/MacOS/CuteLoggeProject (0x10f0ec1e0). One of the two will be used. Which one is undefined.
So, what is that Class ... is implemented in both ...?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
