c++ - __declspec (dllexport) custom type variable -


i'm working on visual studio solution multiple projects (visual studio 2013). 1 project generating .dll file, other projects use .dll file , generate .exe files. when export standard type variable works fine. in case if want use custom defined type compilation error. here example

// dll.cpp #define dllexport __declspec (dllexport) dllexport int maxpacksize = 20; // custom type struct dllexport header {     int m_data;    // data }; dllexport header qhead = { 100 };   // exe.cpp #define dllimport __declspec (dllimport) dllimport extern int packetsize;    // ok  struct dllimport header; dllimport extern header qhead;      // leads error 

when use qhead in exe.cpp compilation error on line. error

error c2027: use of undefined type 'header'

what doing wrong? ideas?

the error message compiler error (not linker error!). need define header prior first use.

you move struct dllexport header { ... }; separate header file (e.g. dll.h) , #include "dll.h" in exe.cpp.


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -