Hi Guys,
i m here again for ur help ...

i've prepared a dll, that provides a table in the main program and the excel like operations (cut,copy,paste ....)

my dll is compiling working fine, but when i use that dll warnings and error come.

please look at the following compiler error :

Qt Code:
  1. Compiling...
  2. moc_QGrid.cpp
  3. warning C4273: 'public: static struct QMetaObject const QGrid::staticMetaObject' : inconsistent dll linkage. dllexport assumed.
  4. error C2491: 'QGrid::staticMetaObject' : definition of dllimport static data member not allowed
  5. warning C4273: 'metaObject' : inconsistent dll linkage. dllexport assumed.
  6. warning C4273: 'qt_metacast' : inconsistent dll linkage. dllexport assumed.
  7. warning C4273: 'qt_metacall' : inconsistent dll linkage. dllexport assumed.
  8. Error executing cl.exe.
  9.  
  10. program.exe - 1 error(s), 4 warning(s)
To copy to clipboard, switch view to plain text mode 

my pro file for the main project:

Qt Code:
  1. ######################################################################
  2. # Automatically generated by qmake (2.00a) Mon Jan 2 11:42:05 2006
  3. ######################################################################
  4.  
  5. TEMPLATE = app
  6. TARGET += program
  7. DEPENDPATH += . ui Uidata
  8. INCLUDEPATH += . ../header/
  9.  
  10. # Input
  11. HEADERS += xxx.h yyy.h
  12. FORMS += Uidata/xxx.cpp Uidata/yyy.cpp
  13. SOURCES += xxx.cpp yyy.cpp
  14. RESOURCES += Uidata/tds.qrc
  15. QT += xml
  16. UI_DIR = ui
  17. MOC_DIR = moc
  18. OBJECTS_DIR = obj
  19. LIBS = ../dll/release/QGrid.lib
To copy to clipboard, switch view to plain text mode 

my QGrid.h file is something like this :
Qt Code:
  1. #ifndef QGRID_H
  2. #define QGRID_H
  3. #include <QtCore/qglobal.h>
  4. #include <QTableWidget>
  5.  
  6.  
  7. #ifdef Q_OS_WIN
  8. # ifdef BUILD_QGRID
  9. # define QGRID_EXPORT Q_DECL_EXPORT
  10. # else
  11. # define QGRID_EXPORT Q_DECL_IMPORT
  12. # endif
  13. #else
  14. # define QGRID_EXPORT
  15. #endif
  16.  
  17. #include <QAction>
  18.  
  19. class QGRID_EXPORT QGrid : public QTableWidget
  20. {
  21. Q_OBJECT
  22. public:
  23. QGrid(int c,int r,QWidget *parent = 0);
  24. QGrid(QWidget *parent = 0);
  25.  
  26. private:
  27. QAction *cutAct;
  28. QAction *copyAct;
  29. QAction *pasteAct;
  30.  
  31. public slots:
  32. void cut();
  33. void copy();
  34. void paste();
  35. public:
  36. void setUpContextMenu();
  37. void createActions();
  38. };
  39. #endif
To copy to clipboard, switch view to plain text mode 

i m not getting the cause of the error. i generated the preprocessor files to chk if some problem in macro expansion, but it expands fine .... in dll it expands to __declspec(dllexport) and in the main project it expands to __declspec(dllimport)

when i keep the .cpp and .h file in the main project, this error won't come.

i m using MSVC++ for sompiling the project.

Please help guys, i m stuk for last 1 week in this ...