Problem with vector<vector<struct>>?

DangDKhanh-2637 821 Reputation points

I'm looking for an answer to this problem, I have a functions in dllexport library like this:


struct  ST1 //define global outsize class;  
 CString abc = L"";  
                int a = 1; //  
 int b = 1; //  
 int c=-410;  
 int d=-410;  
class dllexport myclass{  
 void myfunction(bool mycase, vector<vector<ST1>>&); //can't initialize this vector.  
void myclass::myfunction(bool mycase, vector<vector<ST1>>& vec){  
for(int i=1;...)  
     vector<ST1> vec1;  
     for(int j=1;..)  
       vec1.pushback(ST1{..,..,..}); //ok  
     vec.pushback(vec1);// <--  error at this code   

in myproject, I call myfunction by this code:

   vector<vector<ST1>> vec;  
   myclass* cls;  
   //..initialize cls  
   cls->myfunction(true, vec); //error bad array.. at vec.pushback(vec1)  

now, I get these error:


Note: this code runs fine if i use vector<vector<struct>> directly in myproject, but error occurs only after i use it through parameter in function from exportlibrary.

How i can fix this error?
Thanks you!

A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,198 questions
{count} votes

Accepted answer
  1. Viorel 103.2K Reputation points

    Maybe make sure that the Project Properties dialogs of your projects include these settings (for all of platforms):

    • Use of MFC: Use MFC in a Shared DLL,
    • Runtime Library (for Debug Configuration): Multi-threaded Debug DLL (/MDd),
    • Runtime Library (for Release Configuration): Multi-threaded DLL (/MD).
    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful