c++ - A dll with a vector of vectors. in one of its classes methods -


in c++ program i'm trying create dll houses functionality of a* algorithm. encounter problem when trying pass map it, first tried use 2d array, limited map sizes, i'm trying use vector in vector , keep hitting odd snag.

in dlls .h file:

namespace iinterface { class iinterface { public:     // sets map     static __declspec(dllexport) void setmap(int h, int w,vector<vector<byte>> &myarray); private:     static vector<vector<byte>> mymap; } 

finaly in .cpp have:

#include "iinterface.h" #include <windows.h> #include <stdexcept> #include <vector> using namespace std;  namespace iinterface { void iinterface::setmap(int h, int w,vector<vector<byte>> &myarray) {     mymap = myarray; } } 

im getting few errors on compilation tho code looks fine me.

error c2061: syntax error : identifier 'vector' c:\users\steven\documents\github\schooladvgdproject\game code\deathastardll\iinterface.h    7   1   dmastardll error c2143: syntax error : missing ';' before '<'  c:\users\steven\documents\github\schooladvgdproject\game code\deathastardll\iinterface.h    21  1   dmastardll error c2238: unexpected token(s) preceding ';'  c:\users\steven\documents\github\schooladvgdproject\game code\deathastardll\iinterface.h    21  1   dmastardll error c2511: 'void iinterface::iinterface::setmap(int,int,std::vector<_ty> &)' : overloaded member function not found in 'iinterface::iinterface'   c:\users\steven\documents\github\schooladvgdproject\game code\deathastardll\iinterface.cpp  13  1   dmastardll error c4430: missing type specifier - int assumed. note: c++ not support default-int   c:\users\steven\documents\github\schooladvgdproject\game code\deathastardll\iinterface.h    21  1   dmastardll 

i looked @ samples, there nothing matched scenario. have sneaking suspicion i'm forgetting crucial, cant see it. ideas on getting work?

your dlls.h not include vector type - should tell compiler vector definition , include .

tip: don't use using namespace std; in header file in cpp. instead of use std::vector ...etc.

secondly, careful when dll interface contains stl. library differs regards release , debug versions, if load release dll in debug program have problems.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -