cpp new operator ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jmd

    #1

    cpp new operator ?

    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.





  • Bart Jacobs

    #2
    cpp new operator ?

    Your error message is caused by the problem described in
    Microsoft Knowledge Base article 814472
    <http://support.microso ft.com/?id=814472>.

    Comment

    • jmd

      #3
      Re: cpp new operator ?

      Ok.
      Thank you.
      I will study it.

      "Bart Jacobs" <anonymous@disc ussions.microso ft.com> wrote in message
      news:045a01c3ae 35$c9ed2ed0$a50 1280a@phx.gbl.. .[color=blue]
      > Your error message is caused by the problem described in
      > Microsoft Knowledge Base article 814472
      > <http://support.microso ft.com/?id=814472>.[/color]


      Comment

      Working...