J
jmd
Hello.
I would like to dynamically allocate a 2-dimensionns int array in C++ with
the followwing :
I create, in VS Studio.Net 2003, a new Visual Studio C++ Class Library
(.net) project.
I add a few lines in the .h and .cpp generated files which are :
//========= cppnew.h =========
// cppnew.h
#pragma once
using namespace System;
namespace cppnew
{
public __gc class Class1
{
public:
Class1 ( int maxRows, int maxCols ) ;
private:
int **arr;
};
}
//========= cppnew.cpp =========
// This is the main DLL file.
#include "stdafx.h"
#include "cppnew.h"
cppnew::Class1::Class1 ( int maxRows, int maxCols )
{
arr = new int*[maxRows];
// for ( int i = 0; i < maxRows; arr[i++] = new int[maxCols] ) ;
}
//============================
The problem is -> when I compile and link the above code I receive the
following errors :
cppnew error LNK2001: unresolved external symbol "void * __cdecl operator
new(unsigned int)" (??2@$$FYAPAXI@Z)
cppnew fatal error LNK1120: 1 unresolved externals
Can someone help ?
Thank you in advance.
Jean-Marie.
I would like to dynamically allocate a 2-dimensionns int array in C++ with
the followwing :
I create, in VS Studio.Net 2003, a new Visual Studio C++ Class Library
(.net) project.
I add a few lines in the .h and .cpp generated files which are :
//========= cppnew.h =========
// cppnew.h
#pragma once
using namespace System;
namespace cppnew
{
public __gc class Class1
{
public:
Class1 ( int maxRows, int maxCols ) ;
private:
int **arr;
};
}
//========= cppnew.cpp =========
// This is the main DLL file.
#include "stdafx.h"
#include "cppnew.h"
cppnew::Class1::Class1 ( int maxRows, int maxCols )
{
arr = new int*[maxRows];
// for ( int i = 0; i < maxRows; arr[i++] = new int[maxCols] ) ;
}
//============================
The problem is -> when I compile and link the above code I receive the
following errors :
cppnew error LNK2001: unresolved external symbol "void * __cdecl operator
new(unsigned int)" (??2@$$FYAPAXI@Z)
cppnew fatal error LNK1120: 1 unresolved externals
Can someone help ?
Thank you in advance.
Jean-Marie.