Hi All,
I have written two small programs:
Prog1: operator.cpp
#include <iostream>
#include <cstdlib>
#include <new>
using namespace std;
#include <stdio.h>

void *operator new(size_t size)
{

void *p;
cout << "From normal new";
p=malloc(size);
return p;
}



void *operator new(size_t size, int *p)throw()
{
cout << "From placement new";
return p;
}

**************************************************
Program2: main.cpp
#include <new>
int main()
{
int *ptr=new int;
int *ptr1=new(ptr) int(10);
}
************************************************** *
I am individually, compiling operator.cpp " -- g++ -g -c -o operator operator.cpp
and linking it with with main.cpp: g++ -g -o target operator main.cpp

Surprisingly, when i am executing "./target" it is printing: "From normal new"

The expected output is: From normal new
From placement new.

Can anyone please help me regarding this? It is very urgent...please help me if you can.
------------------------------------------------------
Just to add: When the same thing is done in one single file, both the overloaded new are getting called fine.