For some reason when I declare a public or private static QMutex in a class header file and try to use it in the source file, I get to the linking phase and then it barfs.
sclient.o: In function `SClient::setHostName(QString const&)':
/home/rhoover/sclient.cpp:176: undefined reference to `SClient::mutex'
/home/rhoover/sclient.cpp:180: undefined reference to `SClient::mutex'
collect2: ld returned 1 exit status
make: *** [aodsc] Error 1
When I declared it plain as day:
{
Q_OBJECT
public:
~SClient();
...
}
class SClient : public QObject
{
Q_OBJECT
public:
SClient(QObject *parent = 0);
SClient( QObject *parent, const QString & _host, bool _parsing );
~SClient();
static QMutex mutex;
...
}
To copy to clipboard, switch view to plain text mode
Bookmarks