Please see this question for some context: Linking unreferenced libraries breaks my program
I have the following program:
#include <iostream>
int main( int argc, char* argv[] )
{
std::cout << "Hello world" << std::endl;
int *p;
p = new int(3);
std::cout << *p << std::endl;
delete p;
return 0;
}
It works fine until I link to third-party libraries. When I link to the Abaqus libraries that I'll need in a much larger program, the above program crashes when trying to run delete p;
. Using Dependency Walker, I found that the call to operator new
is linked to an operator new
definition provided by Abaqus. However, the call to operator delete
is linked to the standard definition.
I have replaced new
/delete
with ::new
/::delete
and get the same result.
Is there a way to resolve the standard new/delete operators? Alternatively, can I force Visual Studio to link to the correct (standard) definition of these operators?