Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Static inline QReadWriteLock class member

Static inline QReadWriteLock class member

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 157 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Cocojambo
    wrote on last edited by
    #1
    // classname.h
    #pragma once
    #include <QReadWriteLock>
    #include <QString>
    
    class ClassName {
        public:
           /*inline*/ static QReadWriteLock locker;
           inline static QString string;
    };
    
    // classname.cpp
    //QReadWriteLock ClassName::locker;
    

    Could you explain why inline static declaration doesn't work here? But it works when inline keyword is uncommented and the line in classname.cpp is too. For inline static string member it works correctly.

    /another_test/classname.h:6: error: no matching function for call to ‘QReadWriteLock::QReadWriteLock()’
    In file included from ../another_test/classname.cpp:1:
    ../another_test/classname.h:6:38: error: no matching function for call to ‘QReadWriteLock::QReadWriteLock()’
        6 |         inline static QReadWriteLock locker;
          |                                      ^~~~~~
    
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved