cpp new operator ?

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top