Hi, I have this issue. I have header file which looks like this:

Qt Code:
  1. #ifndef CARDMANAGERMD_H
  2. #define CARDMANAGERMD_H
  3.  
  4. #ifdef __APPLE__
  5. #define IMG_PATH "/Applications/Card Manager EIDCze.app/Contents/Resources/"
  6. #elif __unix
  7. #define IMG_PATH "/usr/local/share/crplus-cm-eidcze/"
  8. #endif
  9.  
  10. #include <QtGui>
  11. #include "pkcs11manipulatorMD.h"
  12. #include "messages.h"
  13. #include <QApplication>
  14. #include <QDesktopWidget>
  15. #include <QTranslator>
  16. #include <QListData>
  17. #include <QWebView>
  18. #include <QHostInfo>
  19. #include <stdlib.h>
  20.  
  21. #define H_SPRAVCE 0
  22. #define H_READER 1
  23. #define H_CARD 2
  24. #define H_KEY 3
  25. #define H_CERTIFICATE 4
  26. #define H_CSPPARAM 5
  27. #define H_SOLUTIONS 6
  28. #define H_DATA 7
  29. #define H_DIAG 8
  30.  
  31. #define M_FILE_CHANGEPIN 0
  32. #define M_FILE_CHANGEPUK 1
  33. #define M_FILE_UNBLOCKPIN 2
  34. #define M_FILE_FORGETPIN 3
  35. #define M_FILE_READINFO 4
  36. #define M_FILE_DEFRAGCARD 5
  37. #define M_CERT_DETAIL 6
  38. #define M_CERT_EXPORT 7
  39. #define M_CERT_IMPORTFILE 8
  40. #define M_CERT_DELETE 9
  41. #define M_KEY_EXPORT 10
  42. #define M_KEY_IMPORT 11
  43. #define M_KEY_TEST 12
  44. #define M_KEY_DELETE 13
  45. #define M_DATA_EXPORT 14
  46. #define M_DATA_IMPORT 15
  47. #define M_DATA_ACTUAL 16
  48. #define M_DATA_READVALUE 17
  49. #define M_DATA_DELETE 18
  50.  
  51. #define T_TEXT 0
  52. #define T_DATA 1
  53.  
  54. class CardManager : public QMainWindow
  55. {
  56. Q_OBJECT
  57.  
  58. private:
  59. bool firstTime;
  60. bool reloadBool;
  61. bool libraryLoaded;
  62.  
  63. int containerCount;
  64. int readerSelected;
  65. int containerSelected;
  66. int dataObjectSelected;
  67.  
  68. QString *allPrivateData;
  69. QString *maxPrivateData;
  70. QString *leakPrivateData;
  71.  
  72. QString pinResetDay;
  73. QString pinResetAt;
  74. QTimer *mainTimer;
  75. QTimer *countdownTimer;
  76. QComboBox *cspLanguageW;
  77. QLineEdit *cspTimeoutW;
  78. QCheckBox *cspAnimationW;
  79. QCheckBox *cspRememberPinW;
  80. QLineEdit *cspLimitPinW;
  81.  
  82. QList<QString> readers;
  83. QList<QString> vendors;
  84. QList<bool> sCardConnects;
  85. QList<QString> *containers;
  86. QList<key_info> *keys;
  87. QList<int> *certificates;
  88. QList<QString> *dataObjects;
  89.  
  90. QList<bool> readerConnects;
  91. QList<bool> readerUsbs;
  92. QList<QString> readerVendors;
  93. QList<QString> readerTypes;
  94. QList<QString> readerPorts;
  95. QList<int> cardRoots;
  96. QList<int> cardValidCerts;
  97.  
  98. QList<int> *hardwareGenerated;
  99. QList<int> *signsAllowed;
  100. QList<int> *decryptsAllowed;
  101. QList<bool> *isCA;
  102. QString solutions;
  103. QString diag;
  104. QString defaultCspText;
  105. bool reloaded;
  106. bool canceled;
  107.  
  108. QString *pin;
  109. QString *pinForChange;
  110. QString *resetedPin;
  111. QString *puk;
  112. bool *wrongPinCounter;
  113.  
  114. QProgressDialog* progress;
  115. QMenu *fileMenu;
  116. QMenu *viewMenu;
  117. QMenu *certificateMenu;
  118. QMenu *keyMenu;
  119. //QMenu *dataMenu;
  120. QMenu *helpMenu;
  121. QWidget *infoArea;
  122. QWidget *centWidget;
  123. QTreeWidget *navigator;
  124. QHBoxLayout *mainLayout;
  125. QVBoxLayout *infoLayout;
  126. QStatusBar *statusBar;
  127. QLabel *statusBarText;
  128. QWebView *infoHtml;
  129. QSplitter *splitter;
  130. QScrollArea *scrollArea;
  131.  
  132. QAction *versionAction;
  133. QAction *changePinAction;
  134. QAction *changePukAction;
  135. QAction *unblockPinAction;
  136. QAction *showDiagAction;
  137. QAction *saveDiagAction;
  138. QAction *printAction;
  139. QAction *printSetupAction;
  140. QAction *expertModeAction;
  141. QAction *exitAction;
  142. QAction *reloadAction;
  143. QAction *statusbarAction;
  144. QAction *detailCertAction;
  145. QAction *exportCertAction;
  146. QAction *importCfromFileAction;
  147. QAction *deleteCAction;
  148. QAction *exportKeyAction;
  149. QAction *importKeyAction;
  150. QAction *testKeyAction;
  151. QAction *deleteKAction;
  152. //QAction *exportDataAction;
  153. //QAction *importDataAction;
  154. //QAction *deleteDataAction;
  155. QAction *suggestAction;
  156. QAction *contentsAction;
  157. QAction *aboutAction;
  158.  
  159. QPrinter *printer;
  160. QPageSetupDialog *pageSetup;
  161.  
  162. X509Cert *cert;
  163. X509Viewer *viewer;
  164.  
  165. unsigned long *sCardConnected;
  166. QMessageBox *message;
  167. QInputDialog *input;
  168.  
  169. int initializeTree();
  170. void initializeArea();
  171. void waitForProgress();
  172. void generateHeader(int type);
  173. void generateCopyright();
  174. void menuAllows(QList<int> items);
  175. int verifyPin(int readerNumber);
  176. int verifyPuk(int readerNumber);
  177.  
  178. QString libVersion;
  179. QString language;
  180. QString *diagToSave;
  181. QString *diagCardToSave;
  182. QString diagKeyToSave[128];
  183.  
  184. bool eventFilter( QObject* o, QEvent* e );
  185. public:
  186. QMainWindow mainWindow;
  187. Pkcs11Manipulator *p11manipulator;
  188. bool isLoaded();
  189. QString readHtml(QString filename);
  190.  
  191. CardManager(QWidget *parent = 0);
  192. ~CardManager();
  193.  
  194. private slots:
  195. void quit();
  196. void treeClicked(QTreeWidgetItem *item);
  197. void activatedLink(const QUrl &link);
  198. void version();
  199. void changePin();
  200. void changePuk();
  201. void unblockPin();
  202. void reload();
  203. void statusbarOnOff();
  204. void importCert();
  205. void exportCert();
  206. void showCertview();
  207. void importKey();
  208. void exportKey();
  209. void testKey();
  210. void deleteObject();
  211. void suggestSolutions();
  212. void showDiag();
  213. void saveDiag();
  214. void print();
  215. void printSetup();
  216. void expertMode();
  217. void about();
  218. void checkPinLength(const QString &text);
  219. };
  220.  
  221. #endif // CARDMANAGER_H
To copy to clipboard, switch view to plain text mode 

Now everything works fine. But I wanted to add new menu item, so I added those commented variables. But if I uncomment even one of these (for example QMenu *dataMenu), my application stops working. They are not even used anywhere in cpp file, just declared in header. When I run my application after declaring one of these variables, there is no error, constructor of CardManager class creates everything (I have log on last line of constructor), but application frame never shows up. Why is that? If I declare those variables locally in constructor inside cpp file, everything works fine, but I need them global.