I got it to work by created a new file called global:
#ifndef GLOBAL_H
#define GLOBAL_H
#include "card.h"
extern QVector<Card> cards;
extern int cardIndex;
#endif // GLOBAL_H
#ifndef GLOBAL_H
#define GLOBAL_H
#include "card.h"
extern QVector<Card> cards;
extern int cardIndex;
#endif // GLOBAL_H
To copy to clipboard, switch view to plain text mode
and the .cpp
#include "global.h"
// Global Variables
int cardIndex = 0;
QVector<Card> cards;
#include "global.h"
// Global Variables
int cardIndex = 0;
QVector<Card> cards;
To copy to clipboard, switch view to plain text mode
Why do I have to declare the QVector again in the cpp file?
Bookmarks