Need help to find the issue in the follwing code- thanks in advance
-
Hi , I am very new to QT . Please pardon my ignorance if any. We were using Log4QT for our product. We wanted to upgrade the QT to 5.2 from a very old 3.0 version. The following code gives me 1 issue:
#if QT_VERSION < QT_VERSION_CHECK(4, 4, 0)
#define LOG4QT_DECLARE_STATIC_LOGGER(FUNCTION, CLASS)
static Log4Qt::Logger *FUNCTION()
{
static Log4Qt::Logger *p_logger = 0;
if (!p_logger)
{
q_atomic_test_and_set_ptr(
&p_logger,
0,
Log4Qt::Logger::logger( #CLASS ));
}
return p_logger;
}
#else
#define LOG4QT_DECLARE_STATIC_LOGGER(FUNCTION, CLASS)
static Log4Qt::Logger *FUNCTION()
{
static QBasicAtomicPointer<Log4Qt::Logger > p_logger =
Q_BASIC_ATOMIC_INITIALIZER(0);
p_logger.testAndSetOrdered(0,
Log4Qt::Logger::logger( #CLASS ));
return p_logger;
}
#endiferror: cannot convert 'QBasicAtomicPointerLog4Qt::Logger' to 'Log4Qt::Logger*' in return
return p_logger;
^
QBasicAtomicPointer itself a pointer type. If anybody could please help. -
Hi and welcome to devnet,
Please put your code between coding tags (one @ at the beginning and one at the end)
This will make it readable
-
Thanks for the feedback -- Here follows:
@
#if QT_VERSION < QT_VERSION_CHECK(4, 4, 0)
#define LOG4QT_DECLARE_STATIC_LOGGER(FUNCTION, CLASS)
static Log4Qt::Logger *FUNCTION()
{
static Log4Qt::Logger *p_logger = 0;
if (!p_logger)
{
q_atomic_test_and_set_ptr(
&p_logger,
0,
Log4Qt::Logger::logger( #CLASS ));
}
return p_logger;
}
#else
#define LOG4QT_DECLARE_STATIC_LOGGER(FUNCTION, CLASS) \#define LOG4QT_DECLARE_STATIC_LOGGER(FUNCTION, CLASS) \ static Log4Qt::Logger *FUNCTION() \ { \ static QBasicAtomicPointer<Log4Qt::Logger > p_logger = \ Q_BASIC_ATOMIC_INITIALIZER(0); \ if (p_logger.testAndSetOrdered(0, \ Log4Qt::Logger::logger( #CLASS ))) \ { \ p_logger.testAndSetOrdered(0, \ Log4Qt::Logger::logger( #CLASS )); \ } \ return p_logger; \ }
#endif
@E:\SA\Compliance\customPackages\log4qt-0.3\src\log4qt\logger.h:156: error: cannot convert 'QBasicAtomicPointerLog4Qt::Logger' to 'Log4Qt::Logger*' in return
return p_logger;
^ -
Since you have this "thread":http://qt-project.org/forums/viewthread/38479/ more active, let's continue there
-
I could solve it , actually the was generated class from NetFw.TLB , i got the latest NetFw.TLB and regenerated the .h and .cpp with dumpcpp util
-
Glad you found it !
Then please update the thread title prepending [solved] so other forum users may know a solution has been found :)