Saturday, 10 August 2013

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

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

In my c++ program i'm trying to create a dll that houses the functionality
of my a* algorithm. I encounter a problem when trying to pass the map into
it, I first tried to use a 2d array, but that limited my map sizes, so i'm
now trying to use a vector in a vector and I keep hitting some odd snag.
In my dlls .h file:
namespace IInterface
{
class IInterface
{
public:
// Sets the map
static __declspec(dllexport) void setMap(int h, int
w,vector<vector<byte>> &myarray);
private:
static vector<vector<byte>> mymap;
}
Finaly in the .cpp i 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 a few errors on compilation even tho the code looks fine to 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++ does not
support default-int
c:\users\steven\documents\github\schooladvgdproject\game
code\deathastardll\iinterface.h 21 1 DMAstarDLL
I looked at some samples, but there was really nothing that matched this
scenario. I have a sneaking suspicion i'm forgetting something crucial,
but I cant see it. Ideas on getting this to work?

No comments:

Post a Comment